public void unpinConnection(String host,Integer port){
  connectionLock.lock();
  try {
    String hostAndPort=ConnectionManager.generateConnectionCacheKey(host,port);
    if (pinnedConnections.containsKey(hostAndPort)) {
      Integer count=pinnedConnections.get(hostAndPort) - 1;
      if (count == 0) {
        s_logger.info("CimConnection {} pin count has reached zero; it will be unpinned",hostAndPort);
        pinnedConnections.remove(hostAndPort);
      }
 else {
        s_logger.info("CimConnection {} pin count set to {}",hostAndPort,count);
        pinnedConnections.put(hostAndPort,count);
      }
    }
  }
  finally {
    connectionLock.unlock();
  }
}

public void unpinConnection ( String host , Integer port ) { connectionLock . lock ( ) ; try { String hostAndPort = ConnectionManager . generateConnectionCacheKey ( host , port ) ; if ( pinnedConnections . containsKey ( hostAndPort ) ) { Integer count = pinnedConnections . get ( hostAndPort ) - 1 ; if ( count == 0 ) { s_logger . info ( "CimConnection {} pin count has reached zero; it will be unpinned" , hostAndPort ) ; pinnedConnections . remove ( hostAndPort ) ; } else { s_logger . info ( "CimConnection {} pin count set to {}" , hostAndPort , count ) ; pinnedConnections . put ( hostAndPort , count ) ; } } } finally { connectionLock . unlock ( ) ; } }
this will remove the connection for host + port from the pinned list . it will make the connection eligible for reaping again , if the pin count has reached zero .
