http-clint-branch: review comment - route errors and cf completion fix in SubscriberWrapper http-client-branch
authorchegar
Wed, 20 Jun 2018 16:51:10 +0100
branchhttp-client-branch
changeset 56791 d63e724e85b9
parent 56789 c1cd2326e260
child 56792 9064af483bc5
http-clint-branch: review comment - route errors and cf completion fix in SubscriberWrapper
src/java.net.http/share/classes/jdk/internal/net/http/common/SubscriberWrapper.java
--- a/src/java.net.http/share/classes/jdk/internal/net/http/common/SubscriberWrapper.java	Wed Jun 20 15:56:17 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/SubscriberWrapper.java	Wed Jun 20 16:51:10 2018 +0100
@@ -260,6 +260,8 @@
             try {
                 run1();
             } catch (Throwable t) {
+                if (debug.on())
+                    debug.log("DownstreamPusher threw: " + t);
                 errorCommon(t);
             }
         }
@@ -292,6 +294,7 @@
                 pushScheduler.stop();
                 outputQ.clear();
                 downstreamSubscriber.onError(error);
+                cf.completeExceptionally(error);
                 return;
             }
 
@@ -383,9 +386,8 @@
                 (throwable = new AssertionError("null throwable")) != null;
         if (errorRef.compareAndSet(null, throwable)) {
             if (debug.on()) debug.log("error", throwable);
+            upstreamCompleted = true;
             pushScheduler.runOrSchedule();
-            upstreamCompleted = true;
-            cf.completeExceptionally(throwable);
             return true;
         }
         return false;