@Override
  public ConnectedChannel checkOutConnection(String host, Port port, long timeoutInMs)
      throws IOException, InterruptedException, ConnectionPoolTimeoutException {
    final Timer.Context context = connectionCheckOutTime.time();
    try {
      requestsWaitingToCheckoutConnectionCount.incrementAndGet();
      BlockingChannelInfo blockingChannelInfo = connections.get(host + port.getPort());
      if (blockingChannelInfo == null) {
        synchronized (this) {
          blockingChannelInfo = connections.get(host + port.getPort());
          if (blockingChannelInfo == null) {
            logger.trace("Creating new blocking channel info for host {} and port {}", host, port.getPort());
            blockingChannelInfo = new BlockingChannelInfo(config, host, port, registry, sslSocketFactory, sslConfig);
            connections.put(host + port.getPort(), blockingChannelInfo);
          } else {
            logger.trace("Using already existing BlockingChannelInfo for {}:{} in synchronized block", host,
                port.getPort());
          }
        }
      } else {
        logger.trace("Using already existing BlockingChannelInfo for {}:{}", host, port.getPort());
      }
      return blockingChannelInfo.getBlockingChannel(timeoutInMs);
    } finally {
      requestsWaitingToCheckoutConnectionCount.decrementAndGet();
      context.stop();
    }
  }
A connection pool that uses BlockingChannel as the underlying connection.
It is responsible for all the connection management. It helps to
checkout a new connection, checkin an existing connection that has been
checked out and destroy a connection in the case of an error
ambry-network/src/main/java/com/github/ambry/network/BlockingChannelConnectionPool.java