hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1780654 - /httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
Date Sat, 28 Jan 2017 10:35:00 GMT
Author: olegk
Date: Sat Jan 28 10:35:00 2017
New Revision: 1780654

URL: http://svn.apache.org/viewvc?rev=1780654&view=rev
Log:
HTTPASYNC-116: Remove cancelled lease requests from the request queue when validating pending
requests

Modified:
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java?rev=1780654&r1=1780653&r2=1780654&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
Sat Jan 28 10:35:00 2017
@@ -372,11 +372,18 @@ public class StrictConnPool<T, C extends
             final ListIterator<LeaseRequest<T, C>> it = this.leasingRequests.listIterator();
             while (it.hasNext()) {
                 final LeaseRequest<T, C> request = it.next();
-                final long deadline = request.getDeadline();
-                if (now > deadline) {
+                final BasicFuture<PoolEntry<T, C>> future = request.getFuture();
+                if (future.isCancelled() && !request.isDone()) {
                     it.remove();
-                    request.failed(new TimeoutException());
-                    this.completedRequests.add(request);
+                } else {
+                    final long deadline = request.getDeadline();
+                    if (now > deadline) {
+                        request.failed(new TimeoutException());
+                    }
+                    if (request.isDone()) {
+                        it.remove();
+                        this.completedRequests.add(request);
+                    }
                 }
             }
         } finally {



Mime
View raw message