Remove the volatile modifiers where they are unnecessary

This commit is contained in:
Trustin Lee 2013-06-13 14:43:39 +09:00
parent ef21ab62bb
commit 01d9f10af6
7 changed files with 18 additions and 18 deletions

View File

@ -47,7 +47,7 @@ public final class HttpClientCodec
private final Queue<HttpMethod> queue = new ArrayDeque<HttpMethod>(); private final Queue<HttpMethod> queue = new ArrayDeque<HttpMethod>();
/** If true, decoding stops (i.e. pass-through) */ /** If true, decoding stops (i.e. pass-through) */
private volatile boolean done; private boolean done;
private final AtomicLong requestResponseCounter = new AtomicLong(); private final AtomicLong requestResponseCounter = new AtomicLong();
private final boolean failOnMissingResponse; private final boolean failOnMissingResponse;

View File

@ -34,7 +34,7 @@ import static io.netty.handler.codec.spdy.SpdyCodecUtil.*;
public class SpdyFrameEncoder extends MessageToByteEncoder<SpdyFrame> { public class SpdyFrameEncoder extends MessageToByteEncoder<SpdyFrame> {
private final int version; private final int version;
private volatile boolean finished; private boolean finished;
private final SpdyHeaderBlockCompressor headerBlockCompressor; private final SpdyHeaderBlockCompressor headerBlockCompressor;
/** /**

View File

@ -123,7 +123,7 @@ import java.util.Map;
public class SpdyHttpEncoder extends MessageToMessageEncoder<HttpObject> { public class SpdyHttpEncoder extends MessageToMessageEncoder<HttpObject> {
private final int spdyVersion; private final int spdyVersion;
private volatile int currentStreamId; private int currentStreamId;
/** /**
* Creates a new instance. * Creates a new instance.

View File

@ -167,12 +167,12 @@ final class SpdySession {
private static final class StreamState { private static final class StreamState {
private final byte priority; private final byte priority;
private volatile boolean remoteSideClosed; private boolean remoteSideClosed;
private volatile boolean localSideClosed; private boolean localSideClosed;
private boolean receivedReply; private boolean receivedReply;
private final AtomicInteger sendWindowSize; private final AtomicInteger sendWindowSize;
private final AtomicInteger receiveWindowSize; private final AtomicInteger receiveWindowSize;
private volatile int receiveWindowSizeLowerBound; private int receiveWindowSizeLowerBound;
private final Queue<Object> pendingWriteQueue = new ConcurrentLinkedQueue<Object>(); private final Queue<Object> pendingWriteQueue = new ConcurrentLinkedQueue<Object>();
StreamState( StreamState(

View File

@ -40,24 +40,24 @@ public class SpdySessionHandler
} }
private final SpdySession spdySession = new SpdySession(); private final SpdySession spdySession = new SpdySession();
private volatile int lastGoodStreamId; private int lastGoodStreamId;
private volatile int remoteConcurrentStreams; private int remoteConcurrentStreams;
private volatile int localConcurrentStreams; private int localConcurrentStreams;
private volatile int maxConcurrentStreams; private int maxConcurrentStreams;
private static final int DEFAULT_WINDOW_SIZE = 64 * 1024; // 64 KB default initial window size private static final int DEFAULT_WINDOW_SIZE = 64 * 1024; // 64 KB default initial window size
private volatile int initialSendWindowSize = DEFAULT_WINDOW_SIZE; private int initialSendWindowSize = DEFAULT_WINDOW_SIZE;
private volatile int initialReceiveWindowSize = DEFAULT_WINDOW_SIZE; private int initialReceiveWindowSize = DEFAULT_WINDOW_SIZE;
private final Object flowControlLock = new Object(); private final Object flowControlLock = new Object();
private final AtomicInteger pings = new AtomicInteger(); private final AtomicInteger pings = new AtomicInteger();
private volatile boolean sentGoAwayFrame; private boolean sentGoAwayFrame;
private volatile boolean receivedGoAwayFrame; private boolean receivedGoAwayFrame;
private volatile ChannelPromise closeSessionFuture; private ChannelPromise closeSessionFuture;
private final boolean server; private final boolean server;
private final boolean flowControl; private final boolean flowControl;
@ -748,7 +748,7 @@ public class SpdySessionHandler
return false; return false;
} }
int maxConcurrentStreams = this.maxConcurrentStreams; // read volatile once int maxConcurrentStreams = this.maxConcurrentStreams;
if (maxConcurrentStreams != 0 && if (maxConcurrentStreams != 0 &&
spdySession.numActiveStreams() >= maxConcurrentStreams) { spdySession.numActiveStreams() >= maxConcurrentStreams) {
return false; return false;

View File

@ -42,7 +42,7 @@ import io.netty.util.internal.StringUtil;
public abstract class ByteToMessageDecoder extends ChannelInboundHandlerAdapter { public abstract class ByteToMessageDecoder extends ChannelInboundHandlerAdapter {
protected ByteBuf cumulation; protected ByteBuf cumulation;
private volatile boolean singleDecode; private boolean singleDecode;
private boolean decodeWasNull; private boolean decodeWasNull;
private MessageList<Object> out; private MessageList<Object> out;

View File

@ -1069,7 +1069,7 @@ public class SslHandler
} }
private static final class CloseNotifyListener implements ChannelFutureListener { private static final class CloseNotifyListener implements ChannelFutureListener {
volatile boolean done; boolean done;
@Override @Override
public void operationComplete(ChannelFuture future) throws Exception { public void operationComplete(ChannelFuture future) throws Exception {