Corrected debug logs: report zero keep-alive duration as indefinite; use better terminology ('indefinitely' instead of 'for ever')

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1054960 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2011-01-04 10:26:15 +00:00
parent dafdf43025
commit 232ee999c8
2 changed files with 8 additions and 8 deletions

View File

@ -469,12 +469,12 @@ public HttpResponse execute(HttpHost target, HttpRequest request,
long duration = keepAliveStrategy.getKeepAliveDuration(response, context); long duration = keepAliveStrategy.getKeepAliveDuration(response, context);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
String s; String s;
if (duration >= 0) { if (duration > 0) {
s = duration + " " + TimeUnit.MILLISECONDS; s = "for " + duration + " " + TimeUnit.MILLISECONDS;
} else { } else {
s = "ever"; s = "indefinitely";
} }
this.log.debug("Connection can be kept alive for " + s); this.log.debug("Connection can be kept alive " + s);
} }
managedConn.setIdleDuration(duration, TimeUnit.MILLISECONDS); managedConn.setIdleDuration(duration, TimeUnit.MILLISECONDS);
} }

View File

@ -452,13 +452,13 @@ public void freeEntry(BasicPoolEntry entry, boolean reusable, long validDuration
if (reusable) { if (reusable) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
String s; String s;
if (validDuration >= 0) { if (validDuration > 0) {
s = validDuration + " " + timeUnit; s = "for " + validDuration + " " + timeUnit;
} else { } else {
s = "ever"; s = "indefinitely";
} }
log.debug("Pooling connection" + log.debug("Pooling connection" +
" [" + route + "][" + entry.getState() + "]; keep alive for " + s); " [" + route + "][" + entry.getState() + "]; keep alive " + s);
} }
rospl.freeEntry(entry); rospl.freeEntry(entry);
entry.updateExpiry(validDuration, timeUnit); entry.updateExpiry(validDuration, timeUnit);