HBASE-14458 AsyncRpcClient#createRpcChannel() should check and remove dead channel before creating new one to same server (Samir Ahmic)

This commit is contained in:
tedyu 2015-10-18 20:49:31 -07:00
parent f1b6355fc5
commit 8e6316a80c
1 changed files with 5 additions and 1 deletions

View File

@ -386,7 +386,11 @@ public class AsyncRpcClient extends AbstractRpcClient {
throw new StoppedRpcClientException();
}
rpcChannel = connections.get(hashCode);
if (rpcChannel == null || !rpcChannel.isAlive()) {
if (rpcChannel != null && !rpcChannel.isAlive()) {
LOG.debug("Removing dead channel from server="+rpcChannel.address.toString());
connections.remove(hashCode);
}
if (rpcChannel == null) {
rpcChannel = new AsyncRpcChannel(this.bootstrap, this, ticket, serviceName, location);
connections.put(hashCode, rpcChannel);
}