|
|
@ -141,7 +141,7 @@ public class NettyRemotingClient implements AutoCloseable { |
|
|
|
return iRpcResponse; |
|
|
|
return iRpcResponse; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Channel getOrCreateChannel(Host host) { |
|
|
|
Channel getOrCreateChannel(Host host) { |
|
|
|
Channel channel = channels.get(host); |
|
|
|
Channel channel = channels.get(host); |
|
|
|
if (channel != null && channel.isActive()) { |
|
|
|
if (channel != null && channel.isActive()) { |
|
|
|
return channel; |
|
|
|
return channel; |
|
|
@ -166,13 +166,10 @@ public class NettyRemotingClient implements AutoCloseable { |
|
|
|
* @param host host |
|
|
|
* @param host host |
|
|
|
* @return channel |
|
|
|
* @return channel |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Channel createChannel(Host host) { |
|
|
|
Channel createChannel(Host host) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
ChannelFuture future; |
|
|
|
ChannelFuture future = bootstrap.connect(new InetSocketAddress(host.getIp(), host.getPort())); |
|
|
|
synchronized (bootstrap) { |
|
|
|
future = future.sync(); |
|
|
|
future = bootstrap.connect(new InetSocketAddress(host.getIp(), host.getPort())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
future.await(clientConfig.getConnectTimeoutMillis()); |
|
|
|
|
|
|
|
if (future.isSuccess()) { |
|
|
|
if (future.isSuccess()) { |
|
|
|
return future.channel(); |
|
|
|
return future.channel(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|