private void cleanupIdleConnections() {
    long closeBeforeTime = EnvironmentEdgeManager.currentTime() - minIdleTimeBeforeClose;
    synchronized (connections) {
      for (T conn : connections.values()) {
        // Remove connection if it has not been chosen by anyone for more than maxIdleTime, and the
        // connection itself has already shutdown. The latter check is because we may still
        // have some pending calls on connection, so we should not shut down the connection outside.
        // The connection itself will disconnect if there is no pending call for maxIdleTime.
        if (conn.getLastTouched() < closeBeforeTime && !conn.isActive()) {
          if (LOG.isTraceEnabled()) {
            LOG.trace("Cleanup idle connection to {}", conn.remoteId().getAddress());
          }
          connections.remove(conn.remoteId(), conn);
          conn.cleanupConnection();
        }
      }
    }
  }
Construct an IPC client for the cluster <code>clusterId</code>
@param conf      configuration
@param clusterId the cluster id
@param localAddr client socket bind address.
@param metrics   the connection metrics
hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java