Top Description Fields Constructors Methods
rx.subscriptions

public final Class CompositeSubscription

extends Object
implements Subscription
Class Inheritance
All Implemented Interfaces
rx.Subscription
Imports
rx.Subscription, rx.exceptions.Exceptions, java.util.ArrayList, .Arrays, .Collection, .HashSet, .List, .Set

Subscription that represents a group of Subscriptions that are unsubscribed together.

All methods of this class are thread-safe.

Field Summary

Modifier and TypeField and Description
private Set<Subscription>
private volatile boolean

Constructor Summary

AccessConstructor and Description
public
CompositeSubscription()

Constructs an empty Composite subscription.

public
CompositeSubscription(final Subscription... subscriptions)

Method Summary

Modifier and TypeMethod and Description
public void
add(final Subscription
the Subscription to add
s
)

Adds a new Subscription to this CompositeSubscription if the CompositeSubscription is not yet unsubscribed.

public void
addAll(final Subscription...
the collection of Subscription to add
subscriptions
)

Adds collection of Subscription to this CompositeSubscription if the CompositeSubscription is not yet unsubscribed.

public 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.

public boolean

Returns:

true if this composite is not unsubscribed and contains subscriptions.
hasSubscriptions
()

Returns true if this composite is not unsubscribed and contains subscriptions.

public boolean
isUnsubscribed()

Implements rx.Subscription.isUnsubscribed.

Indicates whether this Subscription is currently unsubscribed.
public void
remove(final Subscription
the Subscription to remove
s
)

Removes a Subscription from this CompositeSubscription, and unsubscribes the Subscription.

public void
unsubscribe()

Implements rx.Subscription.unsubscribe.

Unsubscribes itself and all inner subscriptions.
private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

subscriptionsback to summary
private Set<Subscription> subscriptions
unsubscribedback to summary
private volatile boolean unsubscribed

Constructor Detail

CompositeSubscriptionback to summary
public CompositeSubscription()

Constructs an empty Composite subscription.

CompositeSubscriptionback to summary
public CompositeSubscription(final Subscription... subscriptions)

Method Detail

addback to summary
public void add(final Subscription s)

Adds a new 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.

Parameters
s:Subscription

the Subscription to add

addAllback to summary
public void addAll(final Subscription... subscriptions)

Adds collection of 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.

Parameters
subscriptions:Subscription[]

the collection of Subscription to add

clearback to summary
public 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.

hasSubscriptionsback to summary
public boolean hasSubscriptions()

Returns true if this composite is not unsubscribed and contains subscriptions.

Returns:boolean

true if this composite is not unsubscribed and contains subscriptions.

Since
1.0.7
isUnsubscribedback to summary
public boolean isUnsubscribed()

Implements rx.Subscription.isUnsubscribed.

Doc from rx.Subscription.isUnsubscribed.

Indicates whether this Subscription is currently unsubscribed.

Returns:boolean

true if this Subscription is currently unsubscribed, false otherwise

Annotations
@Override
removeback to summary
public void remove(final Subscription s)

Removes a Subscription from this CompositeSubscription, and unsubscribes the Subscription.

Parameters
s:Subscription

the Subscription to remove

unsubscribeback to summary
public void unsubscribe()

Implements rx.Subscription.unsubscribe.

Unsubscribes itself and all inner subscriptions.

After call of this method, new Subscriptions added to CompositeSubscription will be unsubscribed immediately.

Annotations
@Override
unsubscribeFromAllback to summary
private static void unsubscribeFromAll(Collection<Subscription> subscriptions)