}
}
public static void release(NHttpClientConnection conn) {
HttpHost host = (HttpHost) conn.getContext().getAttribute(
ExecutionContext.HTTP_TARGET_HOST);
String key = host.getHostName() + ":" + Integer.toString(host.getPort());
List connections = (List) connMap.get(key);
if (connections == null) {
synchronized(connMap) {
// use double locking to make sure
connections = (List) connMap.get(key);
if (connections == null) {
connections = Collections.synchronizedList(new LinkedList());
connMap.put(key, connections);
}
}
}
cleanConnectionReferences(conn);
connections.add(conn);
if (log.isDebugEnabled()) {
log.debug("Released a connection to host: " + host.getHostName() + " on port : " +
host.getPort() + " to the connection pool of current size : " + connections.size());
}
}