Package rx.subscriptions
Class SerialSubscription
java.lang.Object
rx.subscriptions.SerialSubscription
- All Implemented Interfaces:
Subscription
Represents a subscription whose underlying subscription can be swapped for another subscription which causes
the previous underlying subscription to be unsubscribed.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final AtomicReference
<SerialSubscription.State> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget()
Retrieves the currentSubscription
that is being represented by thisSerialSubscription
.boolean
Indicates whether thisSubscription
is currently unsubscribed.void
set
(Subscription s) Swaps out the oldSubscription
for the specifiedSubscription
.void
Stops the receipt of notifications on theSubscriber
that was registered when this Subscription was received.
-
Field Details
-
state
-
-
Constructor Details
-
SerialSubscription
public SerialSubscription()
-
-
Method Details
-
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
Swaps out the oldSubscription
for the specifiedSubscription
.- Parameters:
s
- the newSubscription
to swap in- Throws:
IllegalArgumentException
- ifs
isnull
-
get
Retrieves the currentSubscription
that is being represented by thisSerialSubscription
.- Returns:
- the current
Subscription
that is being represented by thisSerialSubscription
-