Package rx.subscriptions
Class RefCountSubscription
java.lang.Object
rx.subscriptions.RefCountSubscription
- All Implemented Interfaces:
Subscription
Keeps track of the sub-subscriptions and unsubscribes the underlying subscription once all sub-subscriptions
have unsubscribed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classThe individual sub-subscriptions.(package private) static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Subscription(package private) static final RefCountSubscription.State(package private) final AtomicReference<RefCountSubscription.State> -
Constructor Summary
ConstructorsConstructorDescriptionCreates aRefCountSubscriptionby wrapping the given non-nullSubscription. -
Method Summary
Modifier and TypeMethodDescriptionget()Returns a new sub-subscriptionbooleanIndicates whether thisSubscriptionis currently unsubscribed.voidStops the receipt of notifications on theSubscriberthat was registered when this Subscription was received.(package private) voidprivate void
-
Field Details
-
actual
-
EMPTY_STATE
-
state
-
-
Constructor Details
-
RefCountSubscription
Creates aRefCountSubscriptionby wrapping the given non-nullSubscription.- Parameters:
s- theSubscriptionto wrap- Throws:
IllegalArgumentException- ifsisnull
-
-
Method Details
-
get
Returns a new sub-subscription- Returns:
- a new sub-subscription.
-
isUnsubscribed
public boolean isUnsubscribed()Description copied from interface:SubscriptionIndicates whether thisSubscriptionis currently unsubscribed.- Specified by:
isUnsubscribedin interfaceSubscription- Returns:
trueif thisSubscriptionis currently unsubscribed,falseotherwise
-
unsubscribe
public void unsubscribe()Description copied from interface:SubscriptionStops the receipt of notifications on theSubscriberthat was registered when this Subscription was received.This allows unregistering an
Subscriberbefore it has finished receiving all events (i.e. before onCompleted is called).- Specified by:
unsubscribein interfaceSubscription
-
unsubscribeActualIfApplicable
-
unsubscribeAChild
void unsubscribeAChild()
-