8176155: SubmissionPublisher closeExceptionally() may override close()

Reviewed-by: martin, psandoz
This commit is contained in:
Doug Lea 2017-03-07 10:06:39 -08:00
parent d64c22ae61
commit 7849c13436

View File

@ -588,6 +588,7 @@ public class SubmissionPublisher<T> implements Flow.Publisher<T>,
if (!closed) {
BufferedSubscription<T> b;
synchronized (this) {
// no need to re-check closed here
b = clients;
clients = null;
closed = true;
@ -619,9 +620,11 @@ public class SubmissionPublisher<T> implements Flow.Publisher<T>,
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;