@Test public void testCancel() { s.cancel(); verify(s1).cancel(); verifyNoMoreInteractions(s1); s.switchTo(s2); verify(s2).cancel(); verifyNoMoreInteractions(s2); }
@Override public void cancel() { final Subscription currSubscription = subscription; final long currSourceRequested = sourceRequestedUpdater.getAndSet(this, CANCELLED); if (currSourceRequested >= 0) { currSubscription.cancel(); } }
SequentialSubscription implements Subscription, Cancellable { @Override public void cancel() { final Subscription currSubscription = subscription; final long currSourceRequested = sourceRequestedUpdater.getAndSet(this, CANCELLED); if (currSourceRequested >= 0) { currSubscription.cancel(); } } }
SequentialSubscription implements Subscription, Cancellable { @Override public void cancel() { final Subscription currSubscription = subscription; final long currSourceRequested = sourceRequestedUpdater.getAndSet(this, CANCELLED); if (currSourceRequested >= 0) { currSubscription.cancel(); } } SequentialSubscription();   SequentialSubscription(Subscription delegate); }
SequentialSubscription implements Subscription, Cancellable { @Override public void cancel() { final Subscription currSubscription = subscription; final long currSourceRequested = sourceRequestedUpdater.getAndSet(this, CANCELLED); if (currSourceRequested >= 0) { currSubscription.cancel(); } } SequentialSubscription();   SequentialSubscription(Subscription delegate); @Override void request(long n); @Override void cancel(); }
SequentialSubscription implements Subscription, Cancellable { @Override public void cancel() { final Subscription currSubscription = subscription; final long currSourceRequested = sourceRequestedUpdater.getAndSet(this, CANCELLED); if (currSourceRequested >= 0) { currSubscription.cancel(); } } SequentialSubscription();   SequentialSubscription(Subscription delegate); @Override void request(long n); @Override void cancel();  }