[#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 781aa27d42
commit 5b9e55f3ab

View File

@ -699,21 +699,21 @@ public class SpdySessionHandler extends ChannelHandlerAdapter {
} }
// 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 ChannelHandlerAdapter {
// 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;