You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2019/08/16 20:36:08 UTC
[httpcomponents-core] branch master updated: HTTPCORE-590 Ensure
LaxConnPool doesn't leak connections by testing that lease Future
completion is successful.
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
The following commit(s) were added to refs/heads/master by this push:
new 57ec4b7 HTTPCORE-590 Ensure LaxConnPool doesn't leak connections by testing that lease Future completion is successful.
57ec4b7 is described below
commit 57ec4b7bc774d5c1a2c2c418444a70a31e5c9582
Author: Linton Miller <li...@coxautoinc.com>
AuthorDate: Fri Aug 16 20:34:44 2019 +0100
HTTPCORE-590 Ensure LaxConnPool doesn't leak connections
by testing that lease Future completion is successful.
---
.../src/main/java/org/apache/hc/core5/pool/LaxConnPool.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java b/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
index 56e7e88..4fa591c 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
@@ -325,12 +325,12 @@ public class LaxConnPool<T, C extends ModalCloseable> implements ManagedConnPool
return this.future.isDone();
}
- public void completed(final PoolEntry<T, C> result) {
- future.completed(result);
+ public boolean completed(final PoolEntry<T, C> result) {
+ return future.completed(result);
}
- public void failed(final Exception ex) {
- future.failed(ex);
+ public boolean failed(final Exception ex) {
+ return future.failed(ex);
}
@Override
@@ -517,7 +517,9 @@ public class LaxConnPool<T, C extends ModalCloseable> implements ManagedConnPool
}
if (entry != null) {
addLeased(entry);
- leaseRequest.completed(entry);
+ if (!leaseRequest.completed(entry)) {
+ release(entry, true);
+ }
if (serviceStrategy == RequestServiceStrategy.FIRST_SUCCESSFUL) {
break;
}