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 anotherCompletableObserverand catches exceptions thrown by itsonSubscribe,onErrororonCompletemethods 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) CompletableObserverdownstream(package private) booleanonSubscribeFailed
-
Constructor Summary
Constructors Constructor Description SafeCompletableObserver(CompletableObserver downstream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonComplete()Called once the deferred computation completes normally.voidonError(@NonNull java.lang.Throwable e)Called once if the deferred computation 'throws' an exception.voidonSubscribe(@NonNull Disposable d)Called once by theCompletableto set aDisposableon 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:CompletableObserverCalled once by theCompletableto set aDisposableon this instance which then can be used to cancel the subscription at any time.- Specified by:
onSubscribein interfaceCompletableObserver- Parameters:
d- theDisposableinstance to call dispose on for cancellation, not null
-
onError
public void onError(@NonNull @NonNull java.lang.Throwable e)
Description copied from interface:CompletableObserverCalled once if the deferred computation 'throws' an exception.- Specified by:
onErrorin interfaceCompletableObserver- Parameters:
e- the exception, notnull.
-
onComplete
public void onComplete()
Description copied from interface:CompletableObserverCalled once the deferred computation completes normally.- Specified by:
onCompletein interfaceCompletableObserver
-
-