hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1581300 - in /httpcomponents/httpcore/branches/4.3.x: 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:02 GMT
Author: olegk
Date: Tue Mar 25 12:19:01 2014
New Revision: 1581300

URL: http://svn.apache.org/r1581300
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/branches/4.3.x/RELEASE_NOTES.txt
    httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
    httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java

Modified: httpcomponents/httpcore/branches/4.3.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/RELEASE_NOTES.txt?rev=1581300&r1=1581299&r2=1581300&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/branches/4.3.x/RELEASE_NOTES.txt Tue Mar 25 12:19:01 2014
@@ -1,6 +1,10 @@
 Changes since Release 4.3.2
 -------------------
 
+* [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/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java?rev=1581300&r1=1581299&r2=1581300&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
(original)
+++ httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
Tue Mar 25 12:19:01 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;
@@ -506,7 +507,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/branches/4.3.x/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java?rev=1581300&r1=1581299&r2=1581300&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
(original)
+++ httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
Tue Mar 25 12:19:01 2014
@@ -37,6 +37,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;
@@ -240,6 +241,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