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 BooleanSubscription
create()
Creates aBooleanSubscription
without unsubscribe behavior.static BooleanSubscription
Creates aBooleanSubscription
with a specified function to invoke upon unsubscribe.boolean
Indicates whether thisSubscription
is currently unsubscribed.void
Stops the receipt of notifications on theSubscriber
that was registered when this Subscription was received.
-
Field Details
-
actionRef
-
EMPTY_ACTION
-
-
Constructor Details
-
BooleanSubscription
public BooleanSubscription() -
BooleanSubscription
-
-
Method Details
-
create
Creates aBooleanSubscription
without unsubscribe behavior.- Returns:
- the created
BooleanSubscription
-
create
Creates aBooleanSubscription
with a specified function to invoke upon unsubscribe.- Parameters:
onUnsubscribe
- anAction0
to invoke upon unsubscribe- Returns:
- the created
BooleanSubscription
-
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
-
unsubscribe
public void unsubscribe()Description copied from interface:Subscription
Stops the receipt of notifications on theSubscriber
that was registered when this Subscription was received.This allows unregistering an
Subscriber
before it has finished receiving all events (i.e. before onCompleted is called).- Specified by:
unsubscribe
in interfaceSubscription
-