Interface CompletableObserver
-
- All Known Implementing Classes:
BlockingDisposableMultiObserver
,BlockingMultiObserver
,CallbackCompletableObserver
,CompletableAmb.Amb
,CompletableAndThenCompletable.NextObserver
,CompletableAndThenCompletable.SourceObserver
,CompletableAndThenObservable.AndThenObservableObserver
,CompletableAndThenPublisher.AndThenPublisherSubscriber
,CompletableCache
,CompletableConcat.CompletableConcatSubscriber.ConcatInnerObserver
,CompletableConcatArray.ConcatInnerObserver
,CompletableConcatIterable.ConcatInnerObserver
,CompletableDelay.Delay
,CompletableDetach.DetachCompletableObserver
,CompletableDisposeOn.DisposeOnObserver
,CompletableDoFinally.DoFinallyObserver
,CompletableDoOnEvent.DoOnEvent
,CompletableHide.HideCompletableObserver
,CompletableMerge.CompletableMergeSubscriber.MergeInnerObserver
,CompletableMergeArray.InnerCompletableObserver
,CompletableMergeArrayDelayError.MergeInnerCompletableObserver
,CompletableMergeIterable.MergeCompletableObserver
,CompletableObserveOn.ObserveOnCompletableObserver
,CompletableOnErrorComplete.OnError
,CompletableOnErrorReturn.OnErrorReturnMaybeObserver
,CompletablePeek.CompletableObserverImplementation
,CompletableResumeNext.ResumeNextObserver
,CompletableSubject
,CompletableSubscribeOn.SubscribeOnObserver
,CompletableTakeUntilCompletable.TakeUntilMainObserver
,CompletableTakeUntilCompletable.TakeUntilMainObserver.OtherObserver
,CompletableTimeout.DisposeTask.DisposeObserver
,CompletableTimeout.TimeOutObserver
,CompletableToSingle.ToSingle
,CompletableUsing.UsingObserver
,CompletionStageConsumer
,DisposableAutoReleaseMultiObserver
,DisposableCompletableObserver
,EmptyCompletableObserver
,EmptyComponent
,FlowableConcatMapCompletable.ConcatMapCompletableObserver.ConcatMapInnerObserver
,FlowableConcatWithCompletable.ConcatWithSubscriber
,FlowableFlatMapCompletable.FlatMapCompletableMainSubscriber.InnerConsumer
,FlowableFlatMapCompletableCompletable.FlatMapCompletableMainSubscriber.InnerObserver
,FlowableFromCompletable.FromCompletableObserver
,FlowableMergeWithCompletable.MergeWithSubscriber.OtherObserver
,FlowableSwitchMapCompletable.SwitchMapCompletableObserver.SwitchMapInnerObserver
,FutureMultiObserver
,MaterializeSingleObserver
,MaybeDelayWithCompletable.OtherObserver
,MaybeFlatMapCompletable.FlatMapCompletableObserver
,MaybeFromCompletable.FromCompletableObserver
,ObservableConcatMapCompletable.ConcatMapCompletableObserver.ConcatMapInnerObserver
,ObservableConcatWithCompletable.ConcatWithObserver
,ObservableFlatMapCompletable.FlatMapCompletableMainObserver.InnerObserver
,ObservableFlatMapCompletableCompletable.FlatMapCompletableMainObserver.InnerObserver
,ObservableFromCompletable.FromCompletableObserver
,ObservableMergeWithCompletable.MergeWithObserver.OtherObserver
,ObservableSwitchMapCompletable.SwitchMapCompletableObserver.SwitchMapInnerObserver
,ResourceCompletableObserver
,SafeCompletableObserver
,SingleDelayWithCompletable.OtherObserver
,SingleFlatMapCompletable.FlatMapCompletableObserver
,TestObserver
public interface CompletableObserver
Provides a mechanism for receiving push-based notification of a valueless completion or an error.When a
CompletableObserver
is subscribed to aCompletableSource
through theCompletableSource.subscribe(CompletableObserver)
method, theCompletableSource
callsonSubscribe(Disposable)
with aDisposable
that allows disposing the sequence at any time. A well-behavedCompletableSource
will call aCompletableObserver
'sonError(Throwable)
oronComplete()
method exactly once as they are considered mutually exclusive terminal signals.Calling the
CompletableObserver
's method must happen in a serialized fashion, that is, they must not be invoked concurrently by multiple threads in an overlapping fashion and the invocation pattern must adhere to the following protocol:onSubscribe (onError | onComplete)?
Subscribing a
CompletableObserver
to multipleCompletableSource
s is not recommended. If such reuse happens, it is the duty of theCompletableObserver
implementation to be ready to receive multiple calls to its methods and ensure proper concurrent behavior of its business logic.Calling
onSubscribe(Disposable)
oronError(Throwable)
with anull
argument is forbidden.The implementations of the
onXXX
methods should avoid throwing runtime exceptions other than the following cases:- If the argument is
null
, the methods can throw aNullPointerException
. Note though that RxJava preventsnull
s to enter into the flow and thus there is generally no need to check for nulls in flows assembled from standard sources and intermediate operators. - If there is a fatal error (such as
VirtualMachineError
).
- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onComplete()
Called once the deferred computation completes normally.void
onError(@NonNull java.lang.Throwable e)
Called once if the deferred computation 'throws' an exception.void
onSubscribe(@NonNull Disposable d)
Called once by theCompletable
to set aDisposable
on this instance which then can be used to cancel the subscription at any time.
-
-
-
Method Detail
-
onSubscribe
void onSubscribe(@NonNull @NonNull Disposable d)
Called once by theCompletable
to set aDisposable
on this instance which then can be used to cancel the subscription at any time.- Parameters:
d
- theDisposable
instance to call dispose on for cancellation, not null
-
onComplete
void onComplete()
Called once the deferred computation completes normally.
-
-