Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ abstract class RequestOperator
Fuseable.QueueSubscription<Payload>,
Fuseable {

final CorePublisher<Payload> source;
final String errorMessageOnSecondSubscription;

CoreSubscriber<? super Payload> actual;
Expand All @@ -38,8 +39,8 @@ abstract class RequestOperator
AtomicIntegerFieldUpdater.newUpdater(RequestOperator.class, "wip");

RequestOperator(CorePublisher<Payload> source, String errorMessageOnSecondSubscription) {
this.source = source;
this.errorMessageOnSecondSubscription = errorMessageOnSecondSubscription;
source.subscribe(this);
WIP.lazySet(this, -1);
}

Expand All @@ -52,6 +53,7 @@ public void subscribe(Subscriber<? super Payload> actual) {
public void subscribe(CoreSubscriber<? super Payload> actual) {
if (this.wip == -1 && WIP.compareAndSet(this, -1, 0)) {
this.actual = actual;
source.subscribe(this);
actual.onSubscribe(this);
} else {
Operators.error(actual, new IllegalStateException(this.errorMessageOnSecondSubscription));
Expand Down