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 2013/04/02 18:10:56 UTC

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

Author: olegk
Date: Tue Apr  2 16:10:56 2013
New Revision: 1463610

URL: http://svn.apache.org/r1463610
Log:
HTTPCORE-336: Unhandled CancelledKeyException leads to a shutdown of the underlying IOReactor
Contributed by Thomas Dudek <mail.dudek at gmail.com>

Modified:
    httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
    httpcomponents/httpcore/trunk/httpcore-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=1463610&r1=1463609&r2=1463610&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Tue Apr  2 16:10:56 2013
@@ -1,3 +1,10 @@
+Changes since Release 4.3-BETA1
+-------------------
+
+* [HTTPCORE-336]  Unhandled CancelledKeyException leads to a shutdown of the underlying IOReactor.
+  Contributed by Thomas Dudek <mail.dudek at gmail.com> 
+
+
 Release 4.3-BETA1 
 -------------------
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java?rev=1463610&r1=1463609&r2=1463610&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java Tue Apr  2 16:10:56 2013
@@ -399,22 +399,25 @@ public abstract class AbstractIOReactor 
                 };
             }
 
-            final IOSession session = new IOSessionImpl(key, interestOpsCallback, sessionClosedCallback);
-
-            int timeout = 0;
+            final IOSession session;
             try {
-                timeout = channel.socket().getSoTimeout();
-            } catch (final IOException ex) {
-                // Very unlikely to happen and is not fatal
-                // as the protocol layer is expected to overwrite
-                // this value anyways
-            }
-
-            session.setAttribute(IOSession.ATTACHMENT_KEY, entry.getAttachment());
-            session.setSocketTimeout(timeout);
-            this.sessions.add(session);
+                session = new IOSessionImpl(key, interestOpsCallback, sessionClosedCallback);
+                int timeout = 0;
+                try {
+                    timeout = channel.socket().getSoTimeout();
+                } catch (final IOException ex) {
+                    // Very unlikely to happen and is not fatal
+                    // as the protocol layer is expected to overwrite
+                    // this value anyways
+                }
 
+                session.setAttribute(IOSession.ATTACHMENT_KEY, entry.getAttachment());
+                session.setSocketTimeout(timeout);
+            } catch (final CancelledKeyException ex) {
+                continue;
+            }
             try {
+                this.sessions.add(session);
                 final SessionRequestImpl sessionRequest = entry.getSessionRequest();
                 if (sessionRequest != null) {
                     sessionRequest.completed(session);