Package rx.observers
Class SafeCompletableSubscriber
- java.lang.Object
-
- rx.observers.SafeCompletableSubscriber
-
- All Implemented Interfaces:
Completable.CompletableSubscriber,Subscription
@Experimental public final class SafeCompletableSubscriber extends java.lang.Object implements Completable.CompletableSubscriber, Subscription
Wraps another CompletableSubscriber and handles exceptions thrown from onError and onCompleted.- Since:
- (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Completable.CompletableSubscriberactual(package private) booleandone(package private) Subscriptions
-
Constructor Summary
Constructors Constructor Description SafeCompletableSubscriber(Completable.CompletableSubscriber actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisUnsubscribed()Indicates whether thisSubscriptionis currently unsubscribed.voidonCompleted()Called once the deferred computation completes normally.voidonError(java.lang.Throwable e)Called once if the deferred computation 'throws' an exception.voidonSubscribe(Subscription d)Called once by the Completable to set a Subscription on this instance which then can be used to cancel the subscription at any time.voidunsubscribe()Stops the receipt of notifications on theSubscriberthat was registered when this Subscription was received.
-
-
-
Field Detail
-
actual
final Completable.CompletableSubscriber actual
-
s
Subscription s
-
done
boolean done
-
-
Constructor Detail
-
SafeCompletableSubscriber
public SafeCompletableSubscriber(Completable.CompletableSubscriber actual)
-
-
Method Detail
-
onCompleted
public void onCompleted()
Description copied from interface:Completable.CompletableSubscriberCalled once the deferred computation completes normally.- Specified by:
onCompletedin interfaceCompletable.CompletableSubscriber
-
onError
public void onError(java.lang.Throwable e)
Description copied from interface:Completable.CompletableSubscriberCalled once if the deferred computation 'throws' an exception.- Specified by:
onErrorin interfaceCompletable.CompletableSubscriber- Parameters:
e- the exception, not null.
-
onSubscribe
public void onSubscribe(Subscription d)
Description copied from interface:Completable.CompletableSubscriberCalled once by the Completable to set a Subscription on this instance which then can be used to cancel the subscription at any time.- Specified by:
onSubscribein interfaceCompletable.CompletableSubscriber- Parameters:
d- the Subscription instance to call dispose on for cancellation, not null
-
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
-
isUnsubscribed
public boolean isUnsubscribed()
Description copied from interface:SubscriptionIndicates whether thisSubscriptionis currently unsubscribed.- Specified by:
isUnsubscribedin interfaceSubscription- Returns:
trueif thisSubscriptionis currently unsubscribed,falseotherwise
-
-