hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sber...@apache.org
Subject svn commit: r672973 - in /httpcomponents/httpclient/trunk/module-client/src: main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java test/java/org/apache/http/conn/TestConnectionReuse.java
Date Tue, 01 Jul 2008 01:49:11 GMT
Author: sberlin
Date: Mon Jun 30 18:49:10 2008
New Revision: 672973

URL: http://svn.apache.org/viewvc?rev=672973&view=rev
Log:
fixed keep-alive problem reported by Paul Linder -- expired connections weren't accurately
decrementing the total connection count, causing total-connection limits to gradually decay,
stalling connections.

Modified:
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestConnectionReuse.java

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java?rev=672973&r1=672972&r2=672973&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
Mon Jun 30 18:49:10 2008
@@ -448,7 +448,10 @@
                             LOG.debug("Closing expired free connection"
                                     + " [" + rospl.getRoute() + "][" + state + "]");
                         closeConnection(entry.getConnection());
-                        rospl.deleteEntry(entry);
+                        // We use dropEntry instead of deleteEntry because the entry
+                        // is no longer "free" (we just allocated it), and deleteEntry
+                        // can only be used to delete free entries.
+                        rospl.dropEntry();
                         numConnections--;
                     } else {
                         issuedConnections.add(entry.getWeakRef());

Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestConnectionReuse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestConnectionReuse.java?rev=672973&r1=672972&r2=672973&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestConnectionReuse.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestConnectionReuse.java
Mon Jun 30 18:49:10 2008
@@ -311,9 +311,9 @@
         HttpProtocolParams.setUserAgent(params, "TestAgent/1.1");
         HttpProtocolParams.setUseExpectContinue(params, false);
         HttpConnectionParams.setStaleCheckingEnabled(params, false);
-        ConnManagerParams.setMaxTotalConnections(params, 5);
+        ConnManagerParams.setMaxTotalConnections(params, 1);
         ConnManagerParams.setMaxConnectionsPerRoute(params, 
-                new ConnPerRouteBean(5));
+                new ConnPerRouteBean(1));
         
         SchemeRegistry supportedSchemes = new SchemeRegistry();
         SocketFactory sf = PlainSocketFactory.getSocketFactory();
@@ -360,7 +360,7 @@
         
 
         mgr.shutdown();
-    }
+    }    
 
     private static class WorkerThread extends Thread {
 



Mime
View raw message