Package rx.internal.util
Class SubscriptionList
java.lang.Object
rx.internal.util.SubscriptionList
- All Implemented Interfaces:
Subscription
Subscription that represents a group of Subscriptions that are unsubscribed together.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty SubscriptionList.Constructs a SubscriptionList with the given initial child subscription.SubscriptionList(Subscription... subscriptions) Constructs a SubscriptionList with the given initial child subscriptions. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Subscription s) voidclear()booleanReturns true if this composite is not unsubscribed and contains subscriptions.booleanIndicates whether thisSubscriptionis currently unsubscribed.voidvoidUnsubscribe from all of the subscriptions in the list, which stops the receipt of notifications on the associatedSubscriber.private static voidunsubscribeFromAll(Collection<Subscription> subscriptions)
-
Field Details
-
subscriptions
-
unsubscribed
private volatile boolean unsubscribed
-
-
Constructor Details
-
SubscriptionList
public SubscriptionList()Constructs an empty SubscriptionList. -
SubscriptionList
Constructs a SubscriptionList with the given initial child subscriptions.- Parameters:
subscriptions- the array of subscriptions to start with
-
SubscriptionList
Constructs a SubscriptionList with the given initial child subscription.- Parameters:
s- the initial subscription instance
-
-
Method Details
-
isUnsubscribed
public boolean isUnsubscribed()Description copied from interface:SubscriptionIndicates whether thisSubscriptionis currently unsubscribed.- Specified by:
isUnsubscribedin interfaceSubscription- Returns:
trueif thisSubscriptionis currently unsubscribed,falseotherwise
-
add
Adds a newSubscriptionto thisSubscriptionListif theSubscriptionListis not yet unsubscribed. If theSubscriptionListis unsubscribed,addwill indicate this by explicitly unsubscribing the newSubscriptionas well.- Parameters:
s- theSubscriptionto add
-
remove
-
unsubscribe
public void unsubscribe()Unsubscribe from all of the subscriptions in the list, which stops the receipt of notifications on the associatedSubscriber.- Specified by:
unsubscribein interfaceSubscription
-
unsubscribeFromAll
-
clear
public void clear() -
hasSubscriptions
public boolean hasSubscriptions()Returns true if this composite is not unsubscribed and contains subscriptions.- Returns:
trueif this composite is not unsubscribed and contains subscriptions.
-