T - the value type to emitpublic interface SingleEmitter<T>
SingleObserver that allows associating
a resource with it.
All methods are safe to call from multiple threads.
Calling onSuccess or onError multiple times has no effect.
| Modifier and Type | Method and Description |
|---|---|
boolean |
isDisposed()
Returns true if the downstream cancelled the sequence.
|
void |
onError(java.lang.Throwable t)
Signal an exception.
|
void |
onSuccess(T t)
Signal a success value.
|
void |
setCancellable(io.reactivex.common.functions.Cancellable c)
Sets a Cancellable on this emitter; any previous Disposable
or Cancellation will be unsubscribed/cancelled.
|
void |
setDisposable(io.reactivex.common.Disposable s)
Sets a Disposable on this emitter; any previous Disposable
or Cancellation will be unsubscribed/cancelled.
|
boolean |
tryOnError(java.lang.Throwable t)
Attempts to emit the specified
Throwable error if the downstream
hasn't cancelled the sequence or is otherwise terminated, returning false
if the emission is not allowed to happen due to lifecycle restrictions. |
void onSuccess(@NonNull
T t)
t - the value, not nullvoid onError(@NonNull
java.lang.Throwable t)
t - the exception, not nullvoid setDisposable(@Nullable
io.reactivex.common.Disposable s)
s - the disposable, null is allowedvoid setCancellable(@Nullable
io.reactivex.common.functions.Cancellable c)
c - the cancellable resource, null is allowedboolean isDisposed()
boolean tryOnError(@NonNull
java.lang.Throwable t)
Throwable error if the downstream
hasn't cancelled the sequence or is otherwise terminated, returning false
if the emission is not allowed to happen due to lifecycle restrictions.
Unlike onError(Throwable), the RxJavaPlugins.onError is not called
if the error could not be delivered.
History: 2.1.1 - experimental
t - the throwable error to signal if possible