Removed volatile from some internal state member variables in decoders because they are always either:

1) modified from the same threads or
2) protected by happens-before condition that is met by Executor's internal synchronization constructs
This commit is contained in:
Trustin Lee 2010-02-19 09:00:00 +00:00
parent aa8e48df9f
commit a462d0e85e
5 changed files with 9 additions and 9 deletions

View File

@ -53,7 +53,7 @@ import org.jboss.netty.handler.codec.frame.TooLongFrameException;
public class HttpChunkAggregator extends SimpleChannelUpstreamHandler {
private final int maxContentLength;
private volatile HttpMessage currentMessage;
private HttpMessage currentMessage;
/**
* Creates a new instance.

View File

@ -48,7 +48,7 @@ import org.jboss.netty.handler.codec.embedder.DecoderEmbedder;
*/
public abstract class HttpContentDecoder extends SimpleChannelUpstreamHandler {
private volatile DecoderEmbedder<ChannelBuffer> decoder;
private DecoderEmbedder<ChannelBuffer> decoder;
/**
* Creates a new instance.

View File

@ -109,9 +109,9 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<HttpMessageDec
private final int maxInitialLineLength;
private final int maxHeaderSize;
private final int maxChunkSize;
private volatile HttpMessage message;
private volatile ChannelBuffer content;
private volatile long chunkSize;
private HttpMessage message;
private ChannelBuffer content;
private long chunkSize;
private int headerSize;
/**

View File

@ -298,9 +298,9 @@ public abstract class ReplayingDecoder<T extends Enum<T>>
private final AtomicReference<ChannelBuffer> cumulation =
new AtomicReference<ChannelBuffer>();
private final boolean unfold;
private volatile ReplayingDecoderBuffer replayable;
private volatile T state;
private volatile int checkpoint;
private ReplayingDecoderBuffer replayable;
private T state;
private int checkpoint;
/**
* Creates a new instance with no initial state (i.e: {@code null}).

View File

@ -59,7 +59,7 @@ import org.jboss.netty.handler.codec.replay.ReplayingDecoder;
public class CompatibleObjectDecoder extends ReplayingDecoder<CompatibleObjectDecoderState> {
private final SwitchableInputStream bin = new SwitchableInputStream();
private volatile ObjectInputStream oin;
private ObjectInputStream oin;
/**
* Creates a new decoder.