hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1390320 - /httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java
Date Wed, 26 Sep 2012 08:20:31 GMT
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());



Mime
View raw message