hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject httpcomponents-core git commit: Fixed SingleCoreIOReactor not catching CancelledKeyException when handling events
Date Fri, 16 Jun 2017 09:47:38 GMT
Repository: httpcomponents-core
Updated Branches:
  refs/heads/master 1c2698454 -> e5f75c9cc


Fixed SingleCoreIOReactor not catching CancelledKeyException when handling events


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/e5f75c9c
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/e5f75c9c
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/e5f75c9c

Branch: refs/heads/master
Commit: e5f75c9cca97260118dfee197eb0f4158b140482
Parents: 1c26984
Author: Oleg Kalnichevski <olegk@apache.org>
Authored: Fri Jun 16 11:35:53 2017 +0200
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Fri Jun 16 11:35:53 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/e5f75c9c/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
index 05f8c32..9bca4fd 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
@@ -45,6 +45,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.hc.core5.concurrent.ComplexFuture;
 import org.apache.hc.core5.concurrent.FutureCallback;
 import org.apache.hc.core5.function.Callback;
+import org.apache.hc.core5.io.ShutdownType;
 import org.apache.hc.core5.net.NamedEndpoint;
 import org.apache.hc.core5.util.Args;
 import org.apache.hc.core5.util.TimeValue;
@@ -160,7 +161,11 @@ class SingleCoreIOReactor extends AbstractSingleCoreIOReactor implements
Connect
     private void processEvents(final Set<SelectionKey> selectedKeys) {
         for (final SelectionKey key : selectedKeys) {
             final InternalChannel channel = (InternalChannel) key.attachment();
-            channel.handleIOEvent(key.readyOps());
+            try {
+                channel.handleIOEvent(key.readyOps());
+            } catch (final CancelledKeyException ex) {
+                channel.shutdown(ShutdownType.GRACEFUL);
+            }
         }
         selectedKeys.clear();
     }


Mime
View raw message