diff --git a/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java b/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java index 9801cf82e5..070e462540 100644 --- a/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java +++ b/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java @@ -192,7 +192,12 @@ public synchronized PoolEntry get( final boolean acquiredLock; try { - acquiredLock = this.lock.tryLock(requestTimeout.getDuration(), requestTimeout.getTimeUnit()); + if (Timeout.isPositive(requestTimeout)) { + acquiredLock = this.lock.tryLock(requestTimeout.getDuration(), requestTimeout.getTimeUnit()); + } else { + this.lock.lock(); + acquiredLock = true; + } } catch (final InterruptedException interruptedException) { Thread.currentThread().interrupt(); future.cancel();