Use volatile for subscriber in base publishers
Issue: SPR-16207
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user