hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1684107 - in /httpcomponents/httpcore/trunk: httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java
Date Mon, 08 Jun 2015 07:41:25 GMT
Author: olegk
Date: Mon Jun  8 07:41:24 2015
New Revision: 1684107

URL: http://svn.apache.org/r1684107
Log:
RFC 7230: increased the default max number of concurrent connection for the same route from
2 to 5

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java?rev=1684107&r1=1684106&r2=1684107&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
Mon Jun  8 07:41:24 2015
@@ -57,6 +57,9 @@ public class BasicNIOConnPool extends Ab
 
     private static final AtomicLong COUNTER = new AtomicLong();
 
+    public static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 25;
+    public static final int DEFAULT_MAX_CONNECTIONS_PER_ROUTE = 5;
+
     private final int connectTimeout;
 
     static class BasicAddressResolver implements SocketAddressResolver<HttpHost> {
@@ -89,7 +92,7 @@ public class BasicNIOConnPool extends Ab
             final ConnectingIOReactor ioreactor,
             final NIOConnFactory<HttpHost, NHttpClientConnection> connFactory,
             final int connectTimeout) {
-        super(ioreactor, connFactory, new BasicAddressResolver(), 2, 20);
+        super(ioreactor, connFactory, new BasicAddressResolver(), DEFAULT_MAX_CONNECTIONS_PER_ROUTE,
DEFAULT_MAX_TOTAL_CONNECTIONS);
         this.connectTimeout = connectTimeout;
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java?rev=1684107&r1=1684106&r2=1684107&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java
Mon Jun  8 07:41:24 2015
@@ -49,24 +49,37 @@ import org.apache.http.pool.ConnFactory;
 @ThreadSafe
 public class BasicConnPool extends AbstractConnPool<HttpHost, HttpClientConnection, BasicPoolEntry>
{
 
+    public static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 25;
+    public static final int DEFAULT_MAX_CONNECTIONS_PER_ROUTE = 5;
+
     private static final AtomicLong COUNTER = new AtomicLong();
 
+    /**
+     * @since 5.0
+     */
+    public BasicConnPool(
+            final ConnFactory<HttpHost, HttpClientConnection> connFactory,
+            final int defaultMaxPerRoute,
+            final int maxTotal) {
+        super(connFactory, defaultMaxPerRoute, maxTotal);
+    }
+
     public BasicConnPool(final ConnFactory<HttpHost, HttpClientConnection> connFactory)
{
-        super(connFactory, 2, 20);
+        this(connFactory, DEFAULT_MAX_CONNECTIONS_PER_ROUTE, DEFAULT_MAX_TOTAL_CONNECTIONS);
     }
 
     /**
      * @since 4.3
      */
     public BasicConnPool(final SocketConfig sconfig, final ConnectionConfig cconfig) {
-        super(new BasicConnFactory(sconfig, cconfig), 2, 20);
+        this(new BasicConnFactory(sconfig, cconfig));
     }
 
     /**
      * @since 4.3
      */
     public BasicConnPool() {
-        super(new BasicConnFactory(SocketConfig.DEFAULT, ConnectionConfig.DEFAULT), 2, 20);
+        this(new BasicConnFactory(SocketConfig.DEFAULT, ConnectionConfig.DEFAULT));
     }
 
     @Override



Mime
View raw message