Index: src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java =================================================================== --- src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java (revision 1389988) +++ src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java (working copy) @@ -261,15 +261,18 @@ } } } - 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());