HTTPCLIENT-1237: PoolingClientConnectionManager should only update pool expiry for resuable connections

Contributed by Alf Høgemark <alf at i100.no>

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1390317 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2012-09-26 08:15:00 +00:00
parent 8e452a0159
commit c9829f5ac0
1 changed files with 11 additions and 8 deletions

View File

@ -261,15 +261,18 @@ public class PoolingClientConnectionManager implements ClientConnectionManager,
}
}
}
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());