Make code thread-safe by using dirty as a volatile guard
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@755811 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b44390712c
commit
d2a63269e5
|
@ -39,6 +39,8 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.jcip.annotations.ThreadSafe;
|
||||
|
||||
import org.apache.http.Header;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.entity.mime.content.ContentBody;
|
||||
|
@ -54,6 +56,7 @@ import org.apache.james.mime4j.message.Message;
|
|||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
@ThreadSafe
|
||||
public class MultipartEntity implements HttpEntity {
|
||||
|
||||
/**
|
||||
|
@ -68,7 +71,7 @@ public class MultipartEntity implements HttpEntity {
|
|||
private final Header contentType;
|
||||
|
||||
private long length;
|
||||
private boolean dirty;
|
||||
private volatile boolean dirty; // used to decide whether to recalculate length
|
||||
|
||||
public MultipartEntity(
|
||||
HttpMultipartMode mode,
|
||||
|
|
Loading…
Reference in New Issue