Index: MultiThreadedHttpConnectionManager.java =================================================================== --- MultiThreadedHttpConnectionManager.java (revision 292686) +++ MultiThreadedHttpConnectionManager.java (working copy) @@ -58,6 +58,7 @@ * @author Eric Johnson * @author Mike Bowler * @author Carl A. Dunham + * @author Jan de Gorter * * @since 2.0 */ @@ -739,9 +740,12 @@ HostConnectionPool hostPool = getHostPool(hostConfiguration); - if ((hostPool.numConnections < getMaxConnectionsPerHost()) - && (numConnections < getMaxTotalConnections())) { + int maxHostConnections = params.getMaxConnectionsPerHost(hostConfiguration); + int maxTotalConnections = params.getMaxTotalConnections(); + if ((hostPool.numConnections < maxHostConnections) + && (numConnections < maxTotalConnections)) { + if (LOG.isDebugEnabled()) { LOG.debug("Allocating new connection, hostConfig=" + hostConfiguration); } @@ -756,13 +760,13 @@ storeReferenceToConnection(connection, hostConfiguration, this); } else if (LOG.isDebugEnabled()) { - if (hostPool.numConnections >= getMaxConnectionsPerHost()) { + if (hostPool.numConnections >= maxHostConnections) { LOG.debug("No connection allocated, host pool has already reached " + "maxConnectionsPerHost, hostConfig=" + hostConfiguration - + ", maxConnectionsPerhost=" + getMaxConnectionsPerHost()); + + ", maxConnectionsPerhost=" + maxHostConnections); } else { LOG.debug("No connection allocated, maxTotalConnections reached, " - + "maxTotalConnections=" + getMaxTotalConnections()); + + "maxTotalConnections=" + maxTotalConnections); } }