http-client-branch: tweaked last revision wrong CF reference was being kept http-client-branch
authormichaelm
Tue, 27 Feb 2018 19:26:25 +0000
branchhttp-client-branch
changeset 56208 d37c08ce784a
parent 56207 03c89ed2070f
child 56209 43d5ad612710
http-client-branch: tweaked last revision wrong CF reference was being kept
src/java.net.http/share/classes/jdk/internal/net/http/common/SSLFlowDelegate.java
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/SSLFlowDelegate.java	Tue Feb 27 18:43:06 2018 +0000
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLFlowDelegate.java	Tue Feb 27 19:26:25 2018 +0000
@@ -355,7 +355,7 @@
                             }
                         }
                     } catch (IOException ex) {
-                        errorCommon(ex, true);
+                        errorCommon(ex);
                         handleError(ex);
                     }
                     if (handshaking && !complete)
@@ -375,7 +375,7 @@
                     outgoing(Utils.EMPTY_BB_LIST, true);
                 }
             } catch (Throwable ex) {
-                errorCommon(ex, true);
+                errorCommon(ex);
                 handleError(ex);
             }
         }
@@ -581,7 +581,7 @@
                     writer.addData(HS_TRIGGER);
                 }
             } catch (Throwable ex) {
-                errorCommon(ex, true);
+                errorCommon(ex);
                 handleError(ex);
             }
         }
--- a/src/java.net.http/share/classes/jdk/internal/net/http/common/SubscriberWrapper.java	Tue Feb 27 18:43:06 2018 +0000
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/SubscriberWrapper.java	Tue Feb 27 19:26:25 2018 +0000
@@ -92,10 +92,10 @@
     public SubscriberWrapper()
     {
         this.outputQ = new ConcurrentLinkedQueue<>();
-        this.cf = new MinimalFuture<Void>().whenComplete((v,t) ->
-        {
+        this.cf = new MinimalFuture<Void>();
+        cf.whenComplete((v,t) -> {
             if (t != null)
-                errorCommon(t, false);
+                errorCommon(t);
         });
         this.pushScheduler =
                 SequentialScheduler.synchronizedScheduler(new DownstreamPusher());
@@ -259,7 +259,7 @@
             try {
                 run1();
             } catch (Throwable t) {
-                errorCommon(t, true);
+                errorCommon(t);
             }
         }
 
@@ -367,18 +367,17 @@
     @Override
     public void onError(Throwable throwable) {
         logger.log(Level.DEBUG, () -> "onError: " + throwable);
-        errorCommon(Objects.requireNonNull(throwable), true);
+        errorCommon(Objects.requireNonNull(throwable));
     }
 
-    protected boolean errorCommon(Throwable throwable, boolean completecf) {
+    protected boolean errorCommon(Throwable throwable) {
         assert throwable != null ||
                 (throwable = new AssertionError("null throwable")) != null;
         if (errorRef.compareAndSet(null, throwable)) {
             logger.log(Level.DEBUG, "error", throwable);
             pushScheduler.runOrSchedule();
             upstreamCompleted = true;
-            if (completecf)
-                cf.completeExceptionally(throwable);
+            cf.completeExceptionally(throwable);
             return true;
         }
         return false;
@@ -386,18 +385,18 @@
 
     @Override
     public void close() {
-        errorCommon(new RuntimeException("wrapper closed"), true);
+        errorCommon(new RuntimeException("wrapper closed"));
     }
 
     public void close(Throwable t) {
-        errorCommon(t, true);
+        errorCommon(t);
     }
 
     private void incomingCaller(List<ByteBuffer> l, boolean complete) {
         try {
             incoming(l, complete);
         } catch(Throwable t) {
-            errorCommon(t, true);
+            errorCommon(t);
         }
     }