HBASE-21610, numOpenConnections metric is set to -1 when zero server channel exist

This commit is contained in:
Pankaj 2018-12-18 01:31:55 +05:30 committed by stack
parent 8991877bb2
commit 787567336a
1 changed files with 2 additions and 1 deletions

View File

@ -169,8 +169,9 @@ public class NettyRpcServer extends RpcServer {
@Override @Override
public int getNumOpenConnections() { public int getNumOpenConnections() {
int channelsCount = allChannels.size();
// allChannels also contains the server channel, so exclude that from the count. // allChannels also contains the server channel, so exclude that from the count.
return allChannels.size() - 1; return channelsCount > 0 ? channelsCount - 1 : channelsCount;
} }
@Override @Override