Package rx.subscriptions
Class BooleanSubscription
java.lang.Object
rx.subscriptions.BooleanSubscription
- All Implemented Interfaces:
Subscription
Subscription that can be checked for status such as in a loop inside an
Observable to exit the loop
if unsubscribed.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final AtomicReference<Action0> (package private) static final Action0 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BooleanSubscriptioncreate()Creates aBooleanSubscriptionwithout unsubscribe behavior.static BooleanSubscriptionCreates aBooleanSubscriptionwith a specified function to invoke upon unsubscribe.booleanIndicates whether thisSubscriptionis currently unsubscribed.voidStops the receipt of notifications on theSubscriberthat was registered when this Subscription was received.
-
Field Details
-
actionRef
-
EMPTY_ACTION
-
-
Constructor Details
-
BooleanSubscription
public BooleanSubscription() -
BooleanSubscription
-
-
Method Details
-
create
Creates aBooleanSubscriptionwithout unsubscribe behavior.- Returns:
- the created
BooleanSubscription
-
create
Creates aBooleanSubscriptionwith a specified function to invoke upon unsubscribe.- Parameters:
onUnsubscribe- anAction0to invoke upon unsubscribe- Returns:
- the created
BooleanSubscription
-
isUnsubscribed
public boolean isUnsubscribed()Description copied from interface:SubscriptionIndicates whether thisSubscriptionis currently unsubscribed.- Specified by:
isUnsubscribedin interfaceSubscription- Returns:
trueif thisSubscriptionis currently unsubscribed,falseotherwise
-
unsubscribe
public void unsubscribe()Description copied from interface:SubscriptionStops the receipt of notifications on theSubscriberthat was registered when this Subscription was received.This allows unregistering an
Subscriberbefore it has finished receiving all events (i.e. before onCompleted is called).- Specified by:
unsubscribein interfaceSubscription
-