提交 06b2ab39 编写于 作者: R Rossen Stoyanchev

Use volatile for subscriber in base publishers

Issue: SPR-16207
上级 b89a48a7
......@@ -52,17 +52,17 @@ public abstract class AbstractListenerReadPublisher<T> implements Publisher<T> {
private volatile long demand;
private volatile boolean completionBeforeDemand;
@Nullable
private volatile Throwable errorBeforeDemand;
@SuppressWarnings("rawtypes")
private static final AtomicLongFieldUpdater<AbstractListenerReadPublisher> DEMAND_FIELD_UPDATER =
AtomicLongFieldUpdater.newUpdater(AbstractListenerReadPublisher.class, "demand");
@Nullable
private Subscriber<? super T> subscriber;
private volatile Subscriber<? super T> subscriber;
private volatile boolean completionBeforeDemand;
@Nullable
private volatile Throwable errorBeforeDemand;
// Publisher implementation...
......
......@@ -43,7 +43,7 @@ class WriteResultPublisher implements Publisher<Void> {
private final AtomicReference<State> state = new AtomicReference<>(State.UNSUBSCRIBED);
@Nullable
private Subscriber<? super Void> subscriber;
private volatile Subscriber<? super Void> subscriber;
private volatile boolean completedBeforeSubscribed;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册