T
- the value type to emitpublic interface FlowableEmitter<T> extends Emitter<T>
Subscriber
that allows associating
a resource with it and exposes the current number of downstream
requested amount.
The onNext, onError and onComplete methods should be called
in a sequential manner, just like the Subscriber's methods.
Use serialize()
if you want to ensure this.
The other methods are thread-safe.
Modifier and Type | Method and Description |
---|---|
boolean |
isCancelled()
Returns true if the downstream cancelled the sequence.
|
long |
requested()
The current outstanding request amount.
|
FlowableEmitter<T> |
serialize()
Ensures that calls to onNext, onError and onComplete are properly serialized.
|
void |
setCancellable(Cancellable c)
Sets a Cancellable on this emitter; any previous Disposable
or Cancellation will be disposed/cancelled.
|
void |
setDisposable(Disposable s)
Sets a Disposable on this emitter; any previous Disposable
or Cancellation will be disposed/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. |
onComplete, onError, onNext
void setDisposable(@Nullable Disposable s)
s
- the disposable, null is allowedvoid setCancellable(@Nullable Cancellable c)
c
- the cancellable resource, null is allowedlong requested()
This method is thread-safe.
boolean isCancelled()
This method is thread-safe.
@NonNull FlowableEmitter<T> serialize()
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 Emitter.onError(Throwable)
, the RxJavaPlugins.onError
is not called
if the error could not be delivered.
t
- the throwable error to signal if possible