public void pinConnection(String host,Integer port){
  connectionLock.lock();
  try {
    String hostAndPort=ConnectionManager.generateConnectionCacheKey(host,port);
    if (_connections.containsKey(hostAndPort)) {
      Integer count=pinnedConnections.get(hostAndPort);
      if (count == null) {
        count=1;
      }
 else {
        count++;
      }
      pinnedConnections.put(hostAndPort,count);
    }
    s_logger.info("CimConnection {} is pinned, count = {}",hostAndPort,pinnedConnections.get(hostAndPort));
  }
  finally {
    connectionLock.unlock();
  }
}

public void pinConnection ( String host , Integer port ) { connectionLock . lock ( ) ; try { String hostAndPort = ConnectionManager . generateConnectionCacheKey ( host , port ) ; if ( _connections . containsKey ( hostAndPort ) ) { Integer count = pinnedConnections . get ( hostAndPort ) ; if ( count == null ) { count = 1 ; } else { count ++ ; } pinnedConnections . put ( hostAndPort , count ) ; } s_logger . info ( "CimConnection {} is pinned, count = {}" , hostAndPort , pinnedConnections . get ( hostAndPort ) ) ; } finally { connectionLock . unlock ( ) ; } }
this will place the connection for the host + port into the pinned list . this will be used as a way to prevent the connection from getting reaped while it is in use for a long period of time . we ' re keeping count of the times that pinconnection is being called for the connection . this is because you can have multiple arrays behind a single provider ip . if discovery is run against the provider , then the same client will be used for all of its arrays . we would need to keep count , so only when the last array ' s discovery is complete , we can safely remove the connection from the pinned list .
