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 class DefaultRequestDirector implements RequestDirector {
long duration = keepAliveStrategy.getKeepAliveDuration(response, context);
if (this.log.isDebugEnabled()) {
String s;
if (duration >= 0) {
s = duration + " " + TimeUnit.MILLISECONDS;
if (duration > 0) {
s = "for " + duration + " " + TimeUnit.MILLISECONDS;
} 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);
}

View File

@ -452,13 +452,13 @@ public class ConnPoolByRoute extends AbstractConnPool { //TODO: remove dependenc
if (reusable) {
if (log.isDebugEnabled()) {
String s;
if (validDuration >= 0) {
s = validDuration + " " + timeUnit;
if (validDuration > 0) {
s = "for " + validDuration + " " + timeUnit;
} else {
s = "ever";
s = "indefinitely";
}
log.debug("Pooling connection" +
" [" + route + "][" + entry.getState() + "]; keep alive for " + s);
" [" + route + "][" + entry.getState() + "]; keep alive " + s);
}
rospl.freeEntry(entry);
entry.updateExpiry(validDuration, timeUnit);