changeset 16796:3479929a0040

Merge
author jwilhelm
date Tue, 07 Mar 2017 19:23:21 +0100
parents ca35f499c66a 4b8e662483a1
children 59a110a38cea
files
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java	Tue Mar 07 19:14:10 2017 +0100
+++ b/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java	Tue Mar 07 19:23:21 2017 +0100
@@ -588,6 +588,7 @@
         if (!closed) {
             BufferedSubscription<T> b;
             synchronized (this) {
+                // no need to re-check closed here
                 b = clients;
                 clients = null;
                 closed = true;
@@ -619,9 +620,11 @@
             BufferedSubscription<T> b;
             synchronized (this) {
                 b = clients;
-                clients = null;
-                closed = true;
-                closedException = error;
+                if (!closed) {  // don't clobber racing close
+                    clients = null;
+                    closedException = error;
+                    closed = true;
+                }
             }
             while (b != null) {
                 BufferedSubscription<T> next = b.next;