Log 'Connection can be kept alive' debug message only if the connection is known be re-usable

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1442567 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-02-05 12:39:32 +00:00
parent 3627984c9d
commit 4a021ce33a
1 changed files with 10 additions and 8 deletions

View File

@ -209,15 +209,17 @@ public class BasicClientConnectionManager implements ClientConnectionManager {
if (managedConn.isOpen() && !managedConn.isMarkedReusable()) {
shutdownConnection(managedConn);
}
this.poolEntry.updateExpiry(keepalive, tunit != null ? tunit : TimeUnit.MILLISECONDS);
if (this.log.isDebugEnabled()) {
String s;
if (keepalive > 0) {
s = "for " + keepalive + " " + tunit;
} else {
s = "indefinitely";
if (managedConn.isMarkedReusable()) {
this.poolEntry.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 can be kept alive " + s);
}
this.log.debug("Connection can be kept alive " + s);
}
} finally {
managedConn.detach();