--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PushGroup.java Mon Feb 05 11:46:00 2018 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PushGroup.java Mon Feb 05 11:54:03 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;
}