commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mbe...@apache.org
Subject svn commit: r441373 - in /jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient: MultiThreadedHttpConnectionManager.java util/IdleConnectionTimeoutThread.java
Date Fri, 08 Sep 2006 04:25:03 GMT
Author: mbecke
Date: Thu Sep  7 21:25:02 2006
New Revision: 441373

URL: http://svn.apache.org/viewvc?view=rev&rev=441373
Log:
Fix for [HTTPCLIENT-597]: MultithreadedConnectionManager and IdleConnectionTimeoutThread improvements

Contributed by SZÜCS Balazs <Balazs.Szuecs at wave-solutions.com> and Michael Becke
Reviewed by Oleg Kalnichevski

Modified:
    jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
    jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.java

Modified: jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java?view=diff&rev=441373&r1=441372&r2=441373
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
(original)
+++ jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java
Thu Sep  7 21:25:02 2006
@@ -595,6 +595,7 @@
      */
     public void closeIdleConnections(long idleTimeout) {
         connectionPool.closeIdleConnections(idleTimeout);
+        deleteClosedConnections();
     }
     
     /**
@@ -798,7 +799,7 @@
             HostConnectionPool hostPool = getHostPool(hostConfiguration);
 
             if (hostPool.freeConnections.size() > 0) {
-                connection = (HttpConnectionWithReference) hostPool.freeConnections.removeFirst();
+                connection = (HttpConnectionWithReference) hostPool.freeConnections.removeLast();
                 freeConnections.remove(connection);
                 // store a reference to this connection so that it can be cleaned up
                 // in the event it is not correctly released

Modified: jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.java?view=diff&rev=441373&r1=441372&r2=441373
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.java
(original)
+++ jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.java
Thu Sep  7 21:25:02 2006
@@ -83,6 +83,15 @@
     }
     
     /**
+     * Handles calling {@link HttpConnectionManager#closeIdleConnections(long) closeIdleConnections()}
+     * and doing any other cleanup work on the given connection mangaer.
+     * @param connectionManager The connection manager to close idle connections for
+     */
+    protected void handleCloseIdleConnections(HttpConnectionManager connectionManager) {
+        connectionManager.closeIdleConnections(connectionTimeout);
+    }
+    
+    /**
      * Closes idle connections.
      */
     public synchronized void run() {
@@ -91,7 +100,7 @@
             
             while (iter.hasNext()) {
                 HttpConnectionManager connectionManager = (HttpConnectionManager) iter.next();
-                connectionManager.closeIdleConnections(connectionTimeout);
+                handleCloseIdleConnections(connectionManager);
             }
             
             try {



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message