Synchronized some method to avoid accessing some field which may be modified in synchronized methods
Project: http://git-wip-us.apache.org/repos/asf/mina/repo Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/011de2a0 Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/011de2a0 Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/011de2a0 Branch: refs/heads/trunk Commit: 011de2a07634ff10568c7b06d871b32c4dc7b171 Parents: dfb570b Author: Emmanuel Lécharny <[email protected]> Authored: Sun May 12 00:23:43 2013 +0200 Committer: Emmanuel Lécharny <[email protected]> Committed: Sun May 12 00:23:43 2013 +0200 ---------------------------------------------------------------------- .../mina/transport/nio/tcp/NioTcpServer.java | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina/blob/011de2a0/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpServer.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpServer.java b/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpServer.java index fdffd7a..034957e 100644 --- a/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpServer.java +++ b/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpServer.java @@ -155,11 +155,11 @@ public class NioTcpServer extends AbstractTcpServer implements SelectorListener * * @return */ - public ServerSocketChannel getServerSocketChannel() { + public synchronized ServerSocketChannel getServerSocketChannel() { return this.serverChannel; } - public void setServerSocketChannel(final ServerSocketChannel serverChannel) { + public synchronized void setServerSocketChannel(final ServerSocketChannel serverChannel) { this.serverChannel = serverChannel; }
