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.CompletableSubscriber
actual
(package private) boolean
done
(package private) Subscription
s
-
Constructor Summary
Constructors Constructor Description SafeCompletableSubscriber(Completable.CompletableSubscriber actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isUnsubscribed()
Indicates whether thisSubscription
is currently unsubscribed.void
onCompleted()
Called once the deferred computation completes normally.void
onError(java.lang.Throwable e)
Called once if the deferred computation 'throws' an exception.void
onSubscribe(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.void
unsubscribe()
Stops the receipt of notifications on theSubscriber
that 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.CompletableSubscriber
Called once the deferred computation completes normally.- Specified by:
onCompleted
in interfaceCompletable.CompletableSubscriber
-
onError
public void onError(java.lang.Throwable e)
Description copied from interface:Completable.CompletableSubscriber
Called once if the deferred computation 'throws' an exception.- Specified by:
onError
in interfaceCompletable.CompletableSubscriber
- Parameters:
e
- the exception, not null.
-
onSubscribe
public void onSubscribe(Subscription d)
Description copied from interface:Completable.CompletableSubscriber
Called 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:
onSubscribe
in interfaceCompletable.CompletableSubscriber
- Parameters:
d
- the Subscription instance to call dispose on for cancellation, not null
-
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
-
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
-
-