[#2677] Remove unnessary synchronized in SpdySessionHandler

Motivation:

As all methods in the ChannelHandler are executed by the same thread there is no need to use synchronized.

Modifications:

Remove synchronized keyword.

Result:

No more unnessary synchronized in SpdySessionHandler.
This commit is contained in:
Norman Maurer 2015-08-28 21:07:29 +02:00
parent 0c83542000
commit d9d488e477

View File

@ -699,21 +699,21 @@ public class SpdySessionHandler extends ChannelDuplexHandler {
} }
// need to synchronize to prevent new streams from being created while updating active streams // need to synchronize to prevent new streams from being created while updating active streams
private synchronized void updateInitialSendWindowSize(int newInitialWindowSize) { private void updateInitialSendWindowSize(int newInitialWindowSize) {
int deltaWindowSize = newInitialWindowSize - initialSendWindowSize; int deltaWindowSize = newInitialWindowSize - initialSendWindowSize;
initialSendWindowSize = newInitialWindowSize; initialSendWindowSize = newInitialWindowSize;
spdySession.updateAllSendWindowSizes(deltaWindowSize); spdySession.updateAllSendWindowSizes(deltaWindowSize);
} }
// need to synchronize to prevent new streams from being created while updating active streams // need to synchronize to prevent new streams from being created while updating active streams
private synchronized void updateInitialReceiveWindowSize(int newInitialWindowSize) { private void updateInitialReceiveWindowSize(int newInitialWindowSize) {
int deltaWindowSize = newInitialWindowSize - initialReceiveWindowSize; int deltaWindowSize = newInitialWindowSize - initialReceiveWindowSize;
initialReceiveWindowSize = newInitialWindowSize; initialReceiveWindowSize = newInitialWindowSize;
spdySession.updateAllReceiveWindowSizes(deltaWindowSize); spdySession.updateAllReceiveWindowSizes(deltaWindowSize);
} }
// need to synchronize accesses to sentGoAwayFrame, lastGoodStreamId, and initial window sizes // need to synchronize accesses to sentGoAwayFrame, lastGoodStreamId, and initial window sizes
private synchronized boolean acceptStream( private boolean acceptStream(
int streamId, byte priority, boolean remoteSideClosed, boolean localSideClosed) { int streamId, byte priority, boolean remoteSideClosed, boolean localSideClosed) {
// Cannot initiate any new streams after receiving or sending GOAWAY // Cannot initiate any new streams after receiving or sending GOAWAY
if (receivedGoAwayFrame || sentGoAwayFrame) { if (receivedGoAwayFrame || sentGoAwayFrame) {
@ -832,7 +832,7 @@ public class SpdySessionHandler extends ChannelDuplexHandler {
// FIXME: Close the connection forcibly after timeout. // FIXME: Close the connection forcibly after timeout.
} }
private synchronized ChannelFuture sendGoAwayFrame( private ChannelFuture sendGoAwayFrame(
ChannelHandlerContext ctx, SpdySessionStatus status) { ChannelHandlerContext ctx, SpdySessionStatus status) {
if (!sentGoAwayFrame) { if (!sentGoAwayFrame) {
sentGoAwayFrame = true; sentGoAwayFrame = true;