http-client-branch: (WebSocket) merge (2) http-client-branch
authorprappo
Mon, 05 Feb 2018 11:59:39 +0000
branchhttp-client-branch
changeset 56066 f140c8326fd9
parent 56065 67ca659b649f (current diff)
parent 56063 fb2dd3c0dd60 (diff)
child 56068 34eabbaa1226
http-client-branch: (WebSocket) merge (2)
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ConnectionPool.java	Mon Feb 05 11:53:05 2018 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ConnectionPool.java	Mon Feb 05 11:59:39 2018 +0000
@@ -122,7 +122,7 @@
         return dbgTag;
     }
 
-    void start() {
+    synchronized void start() {
         assert !stopped : "Already stopped";
     }
 
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PushGroup.java	Mon Feb 05 11:53:05 2018 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PushGroup.java	Mon Feb 05 11:59:39 2018 +0000
@@ -106,15 +106,16 @@
 
         pushPromiseHandler.applyPushPromise(initiatingRequest, pushRequest, acceptor::accept);
 
-        if (acceptor.accepted()) {
-            if (acceptor.bodyHandler instanceof UntrustedBodyHandler) {
-                ((UntrustedBodyHandler)acceptor.bodyHandler).setAccessControlContext(acc);
+        synchronized (this) {
+            if (acceptor.accepted()) {
+                if (acceptor.bodyHandler instanceof UntrustedBodyHandler) {
+                    ((UntrustedBodyHandler) acceptor.bodyHandler).setAccessControlContext(acc);
+                }
+                numberOfPushes++;
+                remainingPushes++;
             }
-            numberOfPushes++;
-            remainingPushes++;
+            return acceptor;
         }
-        return acceptor;
-
     }
 
     // This is called when the main body response completes because it means
@@ -126,7 +127,7 @@
         noMorePushesCF.complete(null);
     }
 
-    CompletableFuture<Void> pushesCF() {
+    synchronized CompletableFuture<Void> pushesCF() {
         return noMorePushesCF;
     }