Skip to content

Inline SubscriptionHelper.isCancelled() #6263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 28, 2018
Merged
Show file tree
Hide file tree
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 @@ -179,7 +179,7 @@ public void dispose() {

@Override
public boolean isDisposed() {
return SubscriptionHelper.isCancelled(get());
return get() == SubscriptionHelper.CANCELLED;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public void dispose() {

@Override
public boolean isDisposed() {
return SubscriptionHelper.isCancelled(get());
return get() == SubscriptionHelper.CANCELLED;
}

@Override
Expand Down Expand Up @@ -462,7 +462,7 @@ public void dispose() {

@Override
public boolean isDisposed() {
return SubscriptionHelper.isCancelled(get());
return get() == SubscriptionHelper.CANCELLED;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public void dispose() {

@Override
public boolean isDisposed() {
return SubscriptionHelper.isCancelled(upstream.get());
return upstream.get() == SubscriptionHelper.CANCELLED;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void onSubscribe(Subscription s) {
public void onNext(Object t) {
if (getAndIncrement() == 0) {
for (;;) {
if (SubscriptionHelper.isCancelled(upstream.get())) {
if (upstream.get() == SubscriptionHelper.CANCELLED) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void dispose() {

@Override
public boolean isDisposed() {
return SubscriptionHelper.isCancelled(first.get());
return first.get() == SubscriptionHelper.CANCELLED;
}

void cancelAndClear() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public void dispose() {

@Override
public boolean isDisposed() {
return SubscriptionHelper.isCancelled(this.get());
return this.get() == SubscriptionHelper.CANCELLED;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void subscribe(Publisher<?>[] others, int n) {
WithLatestInnerSubscriber[] subscribers = this.subscribers;
AtomicReference<Subscription> upstream = this.upstream;
for (int i = 0; i < n; i++) {
if (SubscriptionHelper.isCancelled(upstream.get())) {
if (upstream.get() == SubscriptionHelper.CANCELLED) {
return;
}
others[i].subscribe(subscribers[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void dispose() {

@Override
public boolean isDisposed() {
return SubscriptionHelper.isCancelled(other.get());
return other.get() == SubscriptionHelper.CANCELLED;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@ public void dispose() {

@Override
public boolean isDisposed() {
return SubscriptionHelper.isCancelled(this.get());
return this.get() == SubscriptionHelper.CANCELLED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public boolean cancel(boolean mayInterruptIfRunning) {

@Override
public boolean isCancelled() {
return SubscriptionHelper.isCancelled(upstream.get());
return upstream.get() == SubscriptionHelper.CANCELLED;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@ public static boolean validate(long n) {
public static void reportMoreProduced(long n) {
RxJavaPlugins.onError(new ProtocolViolationException("More produced than requested: " + n));
}
/**
* Check if the given subscription is the common cancelled subscription.
* @param s the subscription to check
* @return true if the subscription is the common cancelled subscription
*/
public static boolean isCancelled(Subscription s) {
return s == CANCELLED;
}

/**
* Atomically sets the subscription on the field and cancels the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,6 @@ public final void dispose() {
*/
@Override
public final boolean isDisposed() {
return SubscriptionHelper.isCancelled(upstream.get());
return upstream.get() == SubscriptionHelper.CANCELLED;
}
}