HTTPCLIENT-1525: fixed inconsistent debug log

Contributed by Joseph Walton <joe at kafsemo.org>

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1624969 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2014-09-15 08:31:28 +00:00
parent 95e5c2441d
commit 3f637807f6
1 changed files with 3 additions and 2 deletions

View File

@ -301,12 +301,13 @@ public class PoolingHttpClientConnectionManager
final ManagedHttpClientConnection conn = entry.getConnection(); final ManagedHttpClientConnection conn = entry.getConnection();
try { try {
if (conn.isOpen()) { if (conn.isOpen()) {
final TimeUnit effectiveUnit = tunit != null ? tunit : TimeUnit.MILLISECONDS;
entry.setState(state); entry.setState(state);
entry.updateExpiry(keepalive, tunit != null ? tunit : TimeUnit.MILLISECONDS); entry.updateExpiry(keepalive, effectiveUnit);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
final String s; final String s;
if (keepalive > 0) { if (keepalive > 0) {
s = "for " + (double) keepalive / 1000 + " seconds"; s = "for " + (double) effectiveUnit.toMillis(keepalive) / 1000 + " seconds";
} else { } else {
s = "indefinitely"; s = "indefinitely";
} }