Hidden Subscription checkcast scalability issue (Fixes
@@ -56,8 +56,7 @@ public class UniCallbackSubscriber<T> implements UniSubscriber<T>, UniSubscripti
@Override
public final void onFailure(Throwable t) {
- UniSubscription sub = SUBSCRIPTION_UPDATER.getAndSet(this, CANCELLED);
- if (sub == CANCELLED) {
+ if (SUBSCRIPTION_UPDATER.getAndSet(this, CANCELLED) == CANCELLED) {
// Already cancelled, do nothing
return;
}
@@ -66,8 +65,7 @@ public class UniCallbackSubscriber<T> implements UniSubscriber<T>, UniSubscripti
@Override
public final void onItem(T x) {
- Subscription sub = SUBSCRIPTION_UPDATER.getAndSet(this, CANCELLED);
- if (sub == CANCELLED) {
+ if (SUBSCRIPTION_UPDATER.getAndSet(this, CANCELLED) == CANCELLED) {
// Already cancelled, do nothing
return;
}
@@ -81,8 +79,8 @@ public class UniCallbackSubscriber<T> implements UniSubscriber<T>, UniSubscripti
@Override
public void cancel() {
- Subscription sub = SUBSCRIPTION_UPDATER.getAndSet(this, CANCELLED);
- if (sub != null) {
+ UniSubscription sub = SUBSCRIPTION_UPDATER.getAndSet(this, CANCELLED);
+ if (sub != CANCELLED) {
sub.cancel();
}
}
