http-client-branch: merge http-client-branch
authorchegar
Wed, 20 Jun 2018 16:53:56 +0100
branchhttp-client-branch
changeset 56792 9064af483bc5
parent 56790 6bade8020cfa (current diff)
parent 56791 d63e724e85b9 (diff)
child 56793 9dd879eefe33
http-client-branch: merge
--- a/src/java.net.http/share/classes/jdk/internal/net/http/common/SubscriberWrapper.java	Wed Jun 20 16:01:16 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/SubscriberWrapper.java	Wed Jun 20 16:53:56 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;