未验证 提交 c4d95fc9 编写于 作者: H Heng Du 提交者: GitHub

Merge pull request #1109 from zhanguohuang/develop-fix-NettyRemotingClient

[ISSUE #1108] Fix concurrent problems with client-side connection creation
...@@ -453,8 +453,7 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti ...@@ -453,8 +453,7 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti
private Channel createChannel(final String addr) throws InterruptedException { private Channel createChannel(final String addr) throws InterruptedException {
ChannelWrapper cw = this.channelTables.get(addr); ChannelWrapper cw = this.channelTables.get(addr);
if (cw != null && cw.isOK()) { if (cw != null && cw.isOK()) {
cw.getChannel().close(); return cw.getChannel();
channelTables.remove(addr);
} }
if (this.lockChannelTables.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) { if (this.lockChannelTables.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) {
...@@ -464,9 +463,7 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti ...@@ -464,9 +463,7 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti
if (cw != null) { if (cw != null) {
if (cw.isOK()) { if (cw.isOK()) {
cw.getChannel().close(); return cw.getChannel();
this.channelTables.remove(addr);
createNewConnection = true;
} else if (!cw.getChannelFuture().isDone()) { } else if (!cw.getChannelFuture().isDone()) {
createNewConnection = false; createNewConnection = false;
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册