Class SafeCompletableObserver
- java.lang.Object
-
- io.reactivex.rxjava3.internal.observers.SafeCompletableObserver
-
- All Implemented Interfaces:
CompletableObserver
public final class SafeCompletableObserver extends java.lang.Object implements CompletableObserver
Wraps anotherCompletableObserver
and catches exceptions thrown by itsonSubscribe
,onError
oronComplete
methods despite the protocol forbids it.Such exceptions are routed to the
RxJavaPlugins.onError(Throwable)
handler.- Since:
- 3.0.0
-
-
Field Summary
Fields Modifier and Type Field Description (package private) CompletableObserver
downstream
(package private) boolean
onSubscribeFailed
-
Constructor Summary
Constructors Constructor Description SafeCompletableObserver(CompletableObserver downstream)
-
Method Summary
All Methods Instance Methods Concrete 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.
-
-
-
Field Detail
-
downstream
final CompletableObserver downstream
-
onSubscribeFailed
boolean onSubscribeFailed
-
-
Constructor Detail
-
SafeCompletableObserver
public SafeCompletableObserver(CompletableObserver downstream)
-
-
Method Detail
-
onSubscribe
public void onSubscribe(@NonNull @NonNull Disposable d)
Description copied from interface:CompletableObserver
Called once by theCompletable
to set aDisposable
on this instance which then can be used to cancel the subscription at any time.- Specified by:
onSubscribe
in interfaceCompletableObserver
- Parameters:
d
- theDisposable
instance to call dispose on for cancellation, not null
-
onError
public void onError(@NonNull @NonNull java.lang.Throwable e)
Description copied from interface:CompletableObserver
Called once if the deferred computation 'throws' an exception.- Specified by:
onError
in interfaceCompletableObserver
- Parameters:
e
- the exception, notnull
.
-
onComplete
public void onComplete()
Description copied from interface:CompletableObserver
Called once the deferred computation completes normally.- Specified by:
onComplete
in interfaceCompletableObserver
-
-