public final class CompositeSubscription extends java.lang.Object implements Subscription
All methods of this class are thread-safe.
Constructor and Description |
---|
CompositeSubscription()
Constructs an empty Composite subscription.
|
CompositeSubscription(Subscription... subscriptions) |
Modifier and Type | Method and Description |
---|---|
void |
add(Subscription s)
Adds a new
Subscription to this CompositeSubscription if the
CompositeSubscription is not yet unsubscribed. |
void |
addAll(Subscription... subscriptions)
Adds collection of
Subscription to this CompositeSubscription if the
CompositeSubscription is not yet unsubscribed. |
void |
clear()
Unsubscribes any subscriptions that are currently part of this
CompositeSubscription and remove
them from the CompositeSubscription so that the CompositeSubscription is empty and
able to manage new subscriptions. |
boolean |
hasSubscriptions()
Returns true if this composite is not unsubscribed and contains subscriptions.
|
boolean |
isUnsubscribed()
Indicates whether this
Subscription is currently unsubscribed. |
void |
remove(Subscription s)
|
void |
unsubscribe()
Unsubscribes itself and all inner subscriptions.
|
public CompositeSubscription()
public CompositeSubscription(Subscription... subscriptions)
public boolean isUnsubscribed()
Subscription
Subscription
is currently unsubscribed.isUnsubscribed
in interface Subscription
true
if this Subscription
is currently unsubscribed, false
otherwisepublic void add(Subscription s)
Subscription
to this CompositeSubscription
if the
CompositeSubscription
is not yet unsubscribed. If the CompositeSubscription
is
unsubscribed, add
will indicate this by explicitly unsubscribing the new Subscription
as
well.s
- the Subscription
to addpublic void addAll(Subscription... subscriptions)
Subscription
to this CompositeSubscription
if the
CompositeSubscription
is not yet unsubscribed. If the CompositeSubscription
is
unsubscribed, addAll
will indicate this by explicitly unsubscribing all Subscription
in collection as
well.subscriptions
- the collection of Subscription
to addpublic void remove(Subscription s)
s
- the Subscription
to removepublic void clear()
CompositeSubscription
and remove
them from the CompositeSubscription
so that the CompositeSubscription
is empty and
able to manage new subscriptions.public void unsubscribe()
After call of this method, new Subscription
s added to CompositeSubscription
will be unsubscribed immediately.
unsubscribe
in interface Subscription
public boolean hasSubscriptions()
true
if this composite is not unsubscribed and contains subscriptions.