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 currentSubscriptionthat is being represented by thisSerialSubscription.booleanIndicates whether thisSubscriptionis currently unsubscribed.voidset(Subscription s) Swaps out the oldSubscriptionfor the specifiedSubscription.voidStops the receipt of notifications on theSubscriberthat 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: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
-
set
Swaps out the oldSubscriptionfor the specifiedSubscription.- Parameters:
s- the newSubscriptionto swap in- Throws:
IllegalArgumentException- ifsisnull
-
get
Retrieves the currentSubscriptionthat is being represented by thisSerialSubscription.- Returns:
- the current
Subscriptionthat is being represented by thisSerialSubscription
-