hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1581301 - in /httpcomponents/httpcore/trunk: RELEASE_NOTES.txt httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
Date Tue, 25 Mar 2014 12:19:46 GMT
Author: olegk
Date: Tue Mar 25 12:19:46 2014
New Revision: 1581301

URL: http://svn.apache.org/r1581301
Log:
HTTPCORE-376: AbstractNIOConnPool#requestCancelled() should not process pending requests wnen
being shut down
Contributed by Dmitry Potapov <potapov.d at gmail.com>

Modified:
    httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java

Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=1581301&r1=1581300&r2=1581301&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Tue Mar 25 12:19:46 2014
@@ -1,6 +1,10 @@
 Changes for release 4.4-alpha1
 -------------------
 
+* [HTTPCORE-376] AbstractNIOConnPool#requestCancelled() should not process pending requests
+  wnen being shut down.
+  Contributed by Dmitry Potapov <potapov.d at gmail.com>
+
 * [HTTPASYNC-69]: async request handler is closed by HttpAsyncRequestExecutor#closed 
   if the underlying connection is found to be in an inconsistent state.
   Contributed by Oleg Kalnichevski <olegk at apache.org>

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java?rev=1581301&r1=1581300&r2=1581301&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
Tue Mar 25 12:19:46 2014
@@ -47,6 +47,7 @@ import org.apache.http.annotation.Thread
 import org.apache.http.concurrent.BasicFuture;
 import org.apache.http.concurrent.FutureCallback;
 import org.apache.http.nio.reactor.ConnectingIOReactor;
+import org.apache.http.nio.reactor.IOReactorStatus;
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.reactor.SessionRequest;
 import org.apache.http.nio.reactor.SessionRequestCallback;
@@ -510,7 +511,9 @@ public abstract class AbstractNIOConnPoo
             this.pending.remove(request);
             final RouteSpecificPool<T, C, E> pool = getPool(route);
             pool.cancelled(request);
-            processNextPendingRequest();
+            if (this.ioreactor.getStatus().compareTo(IOReactorStatus.ACTIVE) <= 0) {
+                processNextPendingRequest();
+            }
         } finally {
             this.lock.unlock();
         }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java?rev=1581301&r1=1581300&r2=1581301&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
Tue Mar 25 12:19:46 2014
@@ -38,6 +38,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.http.concurrent.BasicFuture;
 import org.apache.http.nio.reactor.ConnectingIOReactor;
+import org.apache.http.nio.reactor.IOReactorStatus;
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.reactor.SessionRequest;
 import org.apache.http.nio.reactor.SessionRequestCallback;
@@ -245,6 +246,7 @@ public class TestNIOConnPool {
                 Mockito.any(SocketAddress.class),
                 Mockito.any(), Mockito.any(SessionRequestCallback.class))).
                 thenReturn(sessionRequest);
+        Mockito.when(ioreactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
         final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
         final Future<LocalPoolEntry> future = pool.lease("somehost", null);
 



Mime
View raw message