PoolingClientConnectionManager does not use ClientConnectionOperator#createConnection() method to create new connections
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1442566 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5cd571a159
commit
3627984c9d
|
@ -31,6 +31,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.http.conn.ClientConnectionOperator;
|
||||
import org.apache.http.conn.OperatedClientConnection;
|
||||
import org.apache.http.conn.routing.HttpRoute;
|
||||
import org.apache.http.pool.AbstractConnPool;
|
||||
|
@ -51,9 +52,10 @@ class HttpConnPool extends AbstractConnPool<HttpRoute, OperatedClientConnection,
|
|||
private final TimeUnit tunit;
|
||||
|
||||
public HttpConnPool(final Log log,
|
||||
final ClientConnectionOperator connOperator,
|
||||
final int defaultMaxPerRoute, final int maxTotal,
|
||||
final long timeToLive, final TimeUnit tunit) {
|
||||
super(new InternalConnFactory(), defaultMaxPerRoute, maxTotal);
|
||||
super(new InternalConnFactory(connOperator), defaultMaxPerRoute, maxTotal);
|
||||
this.log = log;
|
||||
this.timeToLive = timeToLive;
|
||||
this.tunit = tunit;
|
||||
|
@ -67,8 +69,14 @@ class HttpConnPool extends AbstractConnPool<HttpRoute, OperatedClientConnection,
|
|||
|
||||
static class InternalConnFactory implements ConnFactory<HttpRoute, OperatedClientConnection> {
|
||||
|
||||
private final ClientConnectionOperator connOperator;
|
||||
|
||||
InternalConnFactory(final ClientConnectionOperator connOperator) {
|
||||
this.connOperator = connOperator;
|
||||
}
|
||||
|
||||
public OperatedClientConnection create(final HttpRoute route) throws IOException {
|
||||
return new DefaultClientConnection();
|
||||
return connOperator.createConnection();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class PoolingClientConnectionManager implements ClientConnectionManager,
|
|||
this.schemeRegistry = schemeRegistry;
|
||||
this.dnsResolver = dnsResolver;
|
||||
this.operator = createConnectionOperator(schemeRegistry);
|
||||
this.pool = new HttpConnPool(this.log, 2, 20, timeToLive, tunit);
|
||||
this.pool = new HttpConnPool(this.log, this.operator, 2, 20, timeToLive, tunit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue