-
- All Implemented Interfaces:
-
com.tds.common.reactor.Subscription
public final class CompositeSubscription implements Subscription
Subscription that represents a group of Subscriptions that are unsubscribed together.
All methods of this class are thread-safe.
-
-
Constructor Summary
Constructors Constructor Description CompositeSubscription()Constructs an empty Composite subscription. CompositeSubscription(Array<Subscription> subscriptions)
-
Method Summary
Modifier and Type Method Description booleanisUnsubscribed()Indicates whether this {@code Subscription}is currently unsubscribed.voidadd(Subscription s)Adds a new Subscription to this {@code CompositeSubscription}if the{@code CompositeSubscription}is not yet unsubscribed.voidaddAll(Array<Subscription> subscriptions)Adds collection of Subscription to this {@code CompositeSubscription}if the{@code CompositeSubscription}is not yet unsubscribed.voidremove(Subscription s)Removes a Subscription from this {@code CompositeSubscription}, and unsubscribes the Subscription.voidclear()Unsubscribes any subscriptions that are currently part of this {@code CompositeSubscription}and removethem from the{@code CompositeSubscription}so that the{@code CompositeSubscription}is empty andable to manage new subscriptions.voidunsubscribe()Unsubscribes itself and all inner subscriptions. booleanhasSubscriptions()Returns true if this composite is not unsubscribed and contains subscriptions. -
-
Constructor Detail
-
CompositeSubscription
CompositeSubscription()
Constructs an empty Composite subscription.
-
CompositeSubscription
CompositeSubscription(Array<Subscription> subscriptions)
-
-
Method Detail
-
isUnsubscribed
boolean isUnsubscribed()
Indicates whether this
{@code Subscription}is currently unsubscribed.
-
add
void add(Subscription s)
Adds a new Subscription to this
{@code CompositeSubscription}if the{@code CompositeSubscription}is not yet unsubscribed. If the{@code CompositeSubscription}isunsubscribed,{@code add}will indicate this by explicitly unsubscribing the new{@code Subscription}aswell.- Parameters:
s- the Subscription to add
-
addAll
void addAll(Array<Subscription> subscriptions)
Adds collection of Subscription to this
{@code CompositeSubscription}if the{@code CompositeSubscription}is not yet unsubscribed. If the{@code CompositeSubscription}isunsubscribed,{@code addAll}will indicate this by explicitly unsubscribing all{@code Subscription}in collection aswell.- Parameters:
subscriptions- the collection of Subscription to add
-
remove
void remove(Subscription s)
Removes a Subscription from this
{@code CompositeSubscription}, and unsubscribes the Subscription.- Parameters:
s- the Subscription to remove
-
clear
void clear()
Unsubscribes any subscriptions that are currently part of this
{@code CompositeSubscription}and removethem from the{@code CompositeSubscription}so that the{@code CompositeSubscription}is empty andable to manage new subscriptions.
-
unsubscribe
void unsubscribe()
Unsubscribes itself and all inner subscriptions.
After call of this method, new
{@code Subscription}s added to CompositeSubscription will be unsubscribed immediately.
-
hasSubscriptions
boolean hasSubscriptions()
Returns true if this composite is not unsubscribed and contains subscriptions.
-
-
-
-