Skip to content

Commit

Permalink
[netty#2677] Remove unnessary synchronized in SpdySessionHandler
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
normanmaurer committed Aug 28, 2015
1 parent 781aa27 commit 5b9e55f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -699,21 +699,21 @@ private boolean isRemoteInitiatedId(int id) {
}

// 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;
initialSendWindowSize = newInitialWindowSize;
spdySession.updateAllSendWindowSizes(deltaWindowSize);
}

// 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;
initialReceiveWindowSize = newInitialWindowSize;
spdySession.updateAllReceiveWindowSizes(deltaWindowSize);
}

// 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) {
// Cannot initiate any new streams after receiving or sending GOAWAY
if (receivedGoAwayFrame || sentGoAwayFrame) {
Expand Down Expand Up @@ -832,7 +832,7 @@ private void sendGoAwayFrame(ChannelHandlerContext ctx, ChannelPromise future) {
// FIXME: Close the connection forcibly after timeout.
}

private synchronized ChannelFuture sendGoAwayFrame(
private ChannelFuture sendGoAwayFrame(
ChannelHandlerContext ctx, SpdySessionStatus status) {
if (!sentGoAwayFrame) {
sentGoAwayFrame = true;
Expand Down

0 comments on commit 5b9e55f

Please sign in to comment.