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 2017/05/09 20:01:53 UTC

[27/50] httpcomponents-core git commit: HTTPCORE-455: fatal Error in an individual worker thread does not cause proper I/O reactor shutdown

HTTPCORE-455: fatal Error in an individual worker thread does not cause proper I/O reactor shutdown

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1792524 13f79535-47bb-0310-9956-ffa450edef68


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

Branch: refs/heads/4.4.x
Commit: efb11b8fd0b54dab147f3c4f63eebf62ae11863c
Parents: bde8ec2
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Apr 24 18:10:17 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Mon Apr 24 18:10:17 2017 +0000

----------------------------------------------------------------------
 .../http/impl/nio/reactor/AbstractMultiworkerIOReactor.java | 9 ++++++---
 .../org/apache/http/nio/reactor/IOReactorException.java     | 7 +++++++
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/efb11b8f/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
index 020804d..44830b6 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
@@ -351,7 +351,7 @@ public abstract class AbstractMultiworkerIOReactor implements IOReactor {
                 // Verify I/O dispatchers
                 for (int i = 0; i < this.workerCount; i++) {
                     final Worker worker = this.workers[i];
-                    final Exception ex = worker.getException();
+                    final Throwable ex = worker.getThrowable();
                     if (ex != null) {
                         throw new IOReactorException(
                                 "I/O dispatch worker terminated abnormally", ex);
@@ -574,7 +574,7 @@ public abstract class AbstractMultiworkerIOReactor implements IOReactor {
         final BaseIOReactor dispatcher;
         final IOEventDispatch eventDispatch;
 
-        private volatile Exception exception;
+        private volatile Throwable exception;
 
         public Worker(final BaseIOReactor dispatcher, final IOEventDispatch eventDispatch) {
             super();
@@ -586,12 +586,15 @@ public abstract class AbstractMultiworkerIOReactor implements IOReactor {
         public void run() {
             try {
                 this.dispatcher.execute(this.eventDispatch);
+            } catch (final Error ex) {
+                this.exception = ex;
+                throw ex;
             } catch (final Exception ex) {
                 this.exception = ex;
             }
         }
 
-        public Exception getException() {
+        public Throwable getThrowable() {
             return this.exception;
         }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/efb11b8f/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
index f3cfe19..917b26a 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
@@ -46,6 +46,13 @@ public class IOReactorException extends IOException {
         }
     }
 
+    public IOReactorException(final String message, final Throwable cause) {
+        super(message);
+        if (cause != null) {
+            initCause(cause);
+        }
+    }
+
     public IOReactorException(final String message) {
         super(message);
     }