You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2012/09/26 10:20:31 UTC

svn commit: r1390320 - /httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java

Author: olegk
Date: Wed Sep 26 08:20:31 2012
New Revision: 1390320

URL: http://svn.apache.org/viewvc?rev=1390320&view=rev
Log:
HTTPCLIENT-1237: PoolingClientConnectionManager should only update pool expiry for resuable connections
Contributed by Alf Høgemark <alf at i100.no>

Modified:
    httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java

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=1390320&r1=1390319&r2=1390320&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 Wed Sep 26 08:20:31 2012
@@ -261,15 +261,18 @@ public class PoolingClientConnectionMana
                         }
                     }
                 }
-                entry.updateExpiry(keepalive, tunit != null ? tunit : TimeUnit.MILLISECONDS);
-                if (this.log.isDebugEnabled()) {
-                    String s;
-                    if (keepalive > 0) {
-                        s = "for " + keepalive + " " + tunit;
-                    } else {
-                        s = "indefinitely";
+                // Only reusable connections can be kept alive
+                if (managedConn.isMarkedReusable()) {
+                    entry.updateExpiry(keepalive, tunit != null ? tunit : TimeUnit.MILLISECONDS);
+                    if (this.log.isDebugEnabled()) {
+                        String s;
+                        if (keepalive > 0) {
+                            s = "for " + keepalive + " " + tunit;
+                        } else {
+                            s = "indefinitely";
+                        }
+                        this.log.debug("Connection " + format(entry) + " can be kept alive " + s);
                     }
-                    this.log.debug("Connection " + format(entry) + " can be kept alive " + s);
                 }
             } finally {
                 this.pool.release(entry, managedConn.isMarkedReusable());