hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1442564 - in /httpcomponents/httpclient/branches/4.2.x: ./ httpclient/src/main/java/org/apache/http/impl/conn/ httpclient/src/test/java/org/apache/http/impl/conn/
Date Tue, 05 Feb 2013 12:38:52 GMT
Author: olegk
Date: Tue Feb  5 12:38:51 2013
New Revision: 1442564

URL: http://svn.apache.org/viewvc?rev=1442564&view=rev
Log:
PoolingClientConnectionManager does not use ClientConnectionOperator#createConnection() method
to create new connections

Modified:
    httpcomponents/httpclient/branches/4.2.x/RELEASE_NOTES.txt
    httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/HttpConnPool.java
    httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java
    httpcomponents/httpclient/branches/4.2.x/httpclient/src/test/java/org/apache/http/impl/conn/ConnPoolBench.java

Modified: httpcomponents/httpclient/branches/4.2.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/RELEASE_NOTES.txt?rev=1442564&r1=1442563&r2=1442564&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/branches/4.2.x/RELEASE_NOTES.txt Tue Feb  5 12:38:51 2013
@@ -1,6 +1,10 @@
 Changes since Release 4.2.3
 -------------------
 
+* PoolingClientConnectionManager does not use ClientConnectionOperator#createConnection()

+  method to create new connections.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * [HTTPCLIENT-1311] Interrupt flag is not preserved where InterruptedException is caught.
   Contributed by Oleg Kalnichevski <olegk at apache.org>
 

Modified: httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/HttpConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/HttpConnPool.java?rev=1442564&r1=1442563&r2=1442564&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/HttpConnPool.java
(original)
+++ httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/HttpConnPool.java
Tue Feb  5 12:38:51 2013
@@ -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;
@@ -48,9 +49,10 @@ class HttpConnPool extends AbstractConnP
     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;
@@ -64,8 +66,14 @@ class HttpConnPool extends AbstractConnP
 
     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();
         }
 
     }

Modified: httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java?rev=1442564&r1=1442563&r2=1442564&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java
(original)
+++ httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java
Tue Feb  5 12:38:51 2013
@@ -112,7 +112,7 @@ public class PoolingClientConnectionMana
         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

Modified: httpcomponents/httpclient/branches/4.2.x/httpclient/src/test/java/org/apache/http/impl/conn/ConnPoolBench.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/httpclient/src/test/java/org/apache/http/impl/conn/ConnPoolBench.java?rev=1442564&r1=1442563&r2=1442564&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/httpclient/src/test/java/org/apache/http/impl/conn/ConnPoolBench.java
(original)
+++ httpcomponents/httpclient/branches/4.2.x/httpclient/src/test/java/org/apache/http/impl/conn/ConnPoolBench.java
Tue Feb  5 12:38:51 2013
@@ -58,7 +58,9 @@ public class ConnPoolBench {
     public static void newPool(int c, long reps) throws Exception {
         Log log = LogFactory.getLog(ConnPoolBench.class);
 
-        HttpConnPool pool = new HttpConnPool(log, c, c * 10, -1, TimeUnit.MILLISECONDS);
+        DefaultClientConnectionOperator connOperator = new DefaultClientConnectionOperator(
+            SchemeRegistryFactory.createDefault());
+        HttpConnPool pool = new HttpConnPool(log, connOperator, c, c * 10, -1, TimeUnit.MILLISECONDS);
 
         WorkerThread1[] workers = new WorkerThread1[c];
         for (int i = 0; i < workers.length; i++) {



Mime
View raw message