hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1772397 - /httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/nio/AbstractNIOConnPool.java
Date Fri, 02 Dec 2016 18:56:41 GMT
Author: olegk
Date: Fri Dec  2 18:56:41 2016
New Revision: 1772397

URL: http://svn.apache.org/viewvc?rev=1772397&view=rev
Log:
HTTPCORE-429: NIO connection pool incorrectly reports the number of pending connections per
individual route

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

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/nio/AbstractNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/nio/AbstractNIOConnPool.java?rev=1772397&r1=1772396&r2=1772397&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/nio/AbstractNIOConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/nio/AbstractNIOConnPool.java
Fri Dec  2 18:56:41 2016
@@ -59,6 +59,7 @@ import org.apache.hc.core5.reactor.Sessi
 import org.apache.hc.core5.reactor.SessionRequestCallback;
 import org.apache.hc.core5.util.Args;
 import org.apache.hc.core5.util.Asserts;
+import org.apache.hc.core5.util.LangUtils;
 
 /**
  * Abstract non-blocking connection pool.
@@ -614,9 +615,15 @@ public abstract class AbstractNIOConnPoo
         this.lock.lock();
         try {
             final RouteSpecificPool<T, C, E> pool = getPool(route);
+            int pendingCount = 0;
+            for (LeaseRequest<T, C, E> request: leasingRequests) {
+                if (LangUtils.equals(route, request.getRoute())) {
+                    pendingCount++;
+                }
+            }
             return new PoolStats(
                     pool.getLeasedCount(),
-                    pool.getPendingCount(),
+                    pendingCount + pool.getPendingCount(),
                     pool.getAvailableCount(),
                     getMax(route));
         } finally {



Mime
View raw message