mirror of
https://github.com/apache/rocketmq.git
synced 2026-10-30 18:44:38 +08:00
Merge pull request #1109 from zhanguohuang/develop-fix-NettyRemotingClient
[ISSUE #1108] Fix concurrent problems with client-side connection creation
This commit is contained in:
@@ -453,8 +453,7 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti
|
||||
private Channel createChannel(final String addr) throws InterruptedException {
|
||||
ChannelWrapper cw = this.channelTables.get(addr);
|
||||
if (cw != null && cw.isOK()) {
|
||||
cw.getChannel().close();
|
||||
channelTables.remove(addr);
|
||||
return cw.getChannel();
|
||||
}
|
||||
|
||||
if (this.lockChannelTables.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) {
|
||||
@@ -464,9 +463,7 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti
|
||||
if (cw != null) {
|
||||
|
||||
if (cw.isOK()) {
|
||||
cw.getChannel().close();
|
||||
this.channelTables.remove(addr);
|
||||
createNewConnection = true;
|
||||
return cw.getChannel();
|
||||
} else if (!cw.getChannelFuture().isDone()) {
|
||||
createNewConnection = false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user