Package rx.subscriptions
Class MultipleAssignmentSubscription
- java.lang.Object
-
- rx.subscriptions.MultipleAssignmentSubscription
-
- All Implemented Interfaces:
Subscription
public final class MultipleAssignmentSubscription extends java.lang.Object implements Subscription
Subscription that can be checked for status such as in a loop inside anObservable
to exit the loop if unsubscribed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
MultipleAssignmentSubscription.State
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.concurrent.atomic.AtomicReference<MultipleAssignmentSubscription.State>
state
-
Constructor Summary
Constructors Constructor Description MultipleAssignmentSubscription()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Subscription
get()
Gets the underlying subscription.boolean
isUnsubscribed()
Indicates whether thisSubscription
is currently unsubscribed.void
set(Subscription s)
Sets the underlying subscription.void
unsubscribe()
Stops the receipt of notifications on theSubscriber
that was registered when this Subscription was received.
-
-
-
Field Detail
-
state
final java.util.concurrent.atomic.AtomicReference<MultipleAssignmentSubscription.State> state
-
-
Method Detail
-
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
-
set
public void set(Subscription s)
Sets the underlying subscription. If theMultipleAssignmentSubscription
is already unsubscribed, setting a new subscription causes the new subscription to also be immediately unsubscribed.- Parameters:
s
- theSubscription
to set- Throws:
java.lang.IllegalArgumentException
- ifs
isnull
-
get
public Subscription get()
Gets the underlying subscription.- Returns:
- the
Subscription
that underlies theMultipleAssignmentSubscription
-
-