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 2008/08/20 19:47:58 UTC

svn commit: r687395 - in /httpcomponents/httpcore/trunk: RELEASE_NOTES.txt module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java

Author: olegk
Date: Wed Aug 20 10:47:52 2008
New Revision: 687395

URL: http://svn.apache.org/viewvc?rev=687395&view=rev
Log:
HTTPCORE-169: Fixed bug causing connecting I/O reactors to shut down due to ClosedChannelException if a pending session request is cancelled before the new channel has been registered with the selector.
Contributed by Anders Wallgren <anders_wallgren at alum.mit.edu>
Reviewed by Oleg Kalnichevski


Modified:
    httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java

Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=687395&r1=687394&r2=687395&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Wed Aug 20 10:47:52 2008
@@ -1,6 +1,11 @@
-Changes since 4.0 Beta2
+Changes since 4.0 Beta 2
 -------------------
 
+* [HTTPCORE-169] Fixed bug causing connecting I/O reactors to shut down due to
+  ClosedChannelException if a pending session request is cancelled before the new
+  channel has been registered with the selector.
+  Contributed by Anders Wallgren <anders_wallgren at alum.mit.edu>
+
 * [HTTPCORE-167] Fixed handling the end of stream (EOF) condition in the #isStale() 
   check of blocking HTTP connections.
   Contributed by Oleg Kalnichevski <olegk at apache.org> 

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java?rev=687395&r1=687394&r2=687395&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java Wed Aug 20 10:47:52 2008
@@ -35,6 +35,7 @@
 import java.io.InterruptedIOException;
 import java.nio.channels.CancelledKeyException;
 import java.nio.channels.Channel;
+import java.nio.channels.ClosedChannelException;
 import java.nio.channels.ClosedSelectorException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
@@ -221,6 +222,13 @@
                 channel = entry.getChannel();
                 channel.configureBlocking(false);
                 key = channel.register(this.selector, 0);
+            } catch (ClosedChannelException ex) {
+                SessionRequestImpl sessionRequest = entry.getSessionRequest();
+                if (sessionRequest != null) {
+                    sessionRequest.failed(ex);
+                }
+                return;
+
             } catch (IOException ex) {
                 throw new IOReactorException("Failure registering channel " +
                         "with the selector", ex);