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 TypeMethodDescriptionvoid
add
(Subscription s) void
clear()
boolean
Returns true if this composite is not unsubscribed and contains subscriptions.boolean
Indicates whether thisSubscription
is currently unsubscribed.void
void
Unsubscribe from all of the subscriptions in the list, which stops the receipt of notifications on the associatedSubscriber
.private static void
unsubscribeFromAll
(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:Subscription
Indicates whether thisSubscription
is currently unsubscribed.- Specified by:
isUnsubscribed
in interfaceSubscription
- Returns:
true
if thisSubscription
is currently unsubscribed,false
otherwise
-
add
Adds a newSubscription
to thisSubscriptionList
if theSubscriptionList
is not yet unsubscribed. If theSubscriptionList
is unsubscribed,add
will indicate this by explicitly unsubscribing the newSubscription
as well.- Parameters:
s
- theSubscription
to 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:
unsubscribe
in interfaceSubscription
-
unsubscribeFromAll
-
clear
public void clear() -
hasSubscriptions
public boolean hasSubscriptions()Returns true if this composite is not unsubscribed and contains subscriptions.- Returns:
true
if this composite is not unsubscribed and contains subscriptions.
-