T - the value typepublic final classSafeObserver<T>extendsObjectimplementsObserver<T>,Disposable
| Constructor and Description |
|---|
SafeObserver(Observer<? superT> downstream)Constructs a SafeObserver by wrapping the given actual Observer. |
| Modifier and Type | Method and Description |
|---|---|
void | dispose()Dispose the resource, the operation should be idempotent. |
boolean | isDisposed()Returns true if this resource has been disposed. |
void | onComplete()Notifies the Observer that the Observable has finished sending push-based notifications. |
void | onError(Throwable t)Notifies the Observer that the Observable has experienced an error condition. |
void | onNext(T t)Provides the Observer with a new item to observe. |
void | onSubscribe(Disposable d)Provides the Observer with the means of cancelling (disposing) the connection (channel) with the Observable in both synchronous (from within Observer.onNext(Object)) and asynchronous manner. |
public void onSubscribe(@NonNullDisposable d)
ObserverObserver.onNext(Object)) and asynchronous manner.onSubscribe in interface Observer<T>d - the Disposable instance whoseDisposable.dispose() can be called anytime to cancel the connectionpublic void dispose()
Disposabledispose in interface Disposablepublic boolean isDisposed()
DisposableisDisposed in interface Disposablepublic void onNext(@NonNullT t)
Observer TheObservable may call this method 0 or more times.
TheObservable will not call this method again after it calls eitherObserver.onComplete() orObserver.onError(java.lang.Throwable).
public void onError(@NonNullThrowable t)
ObserverObservable has experienced an error condition. If theObservable calls this method, it will not thereafter callObserver.onNext(T) orObserver.onComplete().
public void onComplete()
ObserverObservable has finished sending push-based notifications. TheObservable will not call this method if it callsObserver.onError(java.lang.Throwable).
onComplete in interface Observer<T>