@Test public void testImmediateUnsubscribe() { InOrder inOrder = inOrder(main); rcs.unsubscribe(); inOrder.verify(main, times(1)).call(); rcs.unsubscribe(); inOrder.verifyNoMoreInteractions(); }
@Override public void unsubscribe() { State oldState; State newState; do { oldState = state.get(); if (oldState.isUnsubscribed) { return; } newState = oldState.unsubscribe(); } while (!state.compareAndSet(oldState, newState)); unsubscribeActualIfApplicable(newState); }
RefCountSubscription implements Subscription { @Override public void unsubscribe() { State oldState; State newState; do { oldState = state.get(); if (oldState.isUnsubscribed) { return; } newState = oldState.unsubscribe(); } while (!state.compareAndSet(oldState, newState)); unsubscribeActualIfApplicable(newState); } }
RefCountSubscription implements Subscription { @Override public void unsubscribe() { State oldState; State newState; do { oldState = state.get(); if (oldState.isUnsubscribed) { return; } newState = oldState.unsubscribe(); } while (!state.compareAndSet(oldState, newState)); unsubscribeActualIfApplicable(newState); } RefCountSubscription(Subscription s); }
RefCountSubscription implements Subscription { @Override public void unsubscribe() { State oldState; State newState; do { oldState = state.get(); if (oldState.isUnsubscribed) { return; } newState = oldState.unsubscribe(); } while (!state.compareAndSet(oldState, newState)); unsubscribeActualIfApplicable(newState); } RefCountSubscription(Subscription s); @Deprecated Subscription getSubscription(); Subscription get(); boolean isUnsubscribed(); @Override void unsubscribe(); }
RefCountSubscription implements Subscription { @Override public void unsubscribe() { State oldState; State newState; do { oldState = state.get(); if (oldState.isUnsubscribed) { return; } newState = oldState.unsubscribe(); } while (!state.compareAndSet(oldState, newState)); unsubscribeActualIfApplicable(newState); } RefCountSubscription(Subscription s); @Deprecated Subscription getSubscription(); Subscription get(); boolean isUnsubscribed(); @Override void unsubscribe();  }