Skip to content

Commit 03cab39

Browse files
committed
HTTPCLIENT-2379 - Return early when an entry’s lease count is zero, avoiding a second call to the
delegate pool and its resulting IllegalStateException.
1 parent 97703d9 commit 03cab39

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/H2SharingConnPool.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ public void release(final PoolEntry<T, C> entry, final boolean reusable) {
167167
}
168168
final T route = entry.getRoute();
169169
final PerRoutePool<T, C> perRoutePool = perRouteCache.get(route);
170+
if (perRoutePool != null && perRoutePool.getCount(entry) == 0) {
171+
return;
172+
}
170173
if (perRoutePool != null) {
171174
final long count = perRoutePool.release(entry, reusable);
172175
if (count > 0) {

0 commit comments

Comments
 (0)