Revert adding synchronized to swapRequest method as the caller method onWaitEnd(), is only invoked in synchronized code blocks. There is no need to repeat sync it even if java's synchronized keyword holds a reentrant mutex semantic ^_^.

This commit is contained in:
Li Zhanhui 2016-01-12 19:33:39 +08:00
parent 03cdf3a8fe
commit 0b627dde71
1 changed files with 4 additions and 2 deletions

View File

@ -355,7 +355,7 @@ public class RocketMQFirehoseFactory implements FirehoseFactory<ByteBufferInputR
}
}
private synchronized void swapRequests() {
private void swapRequests() {
List<DruidPullRequest> tmp = requestsWrite;
requestsWrite = requestsRead;
requestsRead = tmp;
@ -438,7 +438,9 @@ public class RocketMQFirehoseFactory implements FirehoseFactory<ByteBufferInputR
LOGGER.error("", e);
}
swapRequests();
synchronized (this) {
swapRequests();
}
doPull();
LOGGER.info(getServiceName() + " terminated.");