public interface

FlowableEmitter

implements Emitter<T>
io.reactivex.FlowableEmitter<T>

Class Overview

Abstraction over a Reactive Streams org.reactivestreams.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.

Summary

Public Methods
abstract boolean isCancelled()
Returns true if the downstream cancelled the sequence.
abstract long requested()
The current outstanding request amount.
abstract FlowableEmitter<T> serialize()
Ensures that calls to onNext, onError and onComplete are properly serialized.
abstract void setCancellable(Cancellable c)
Sets a Cancellable on this emitter; any previous Disposable or Cancellation will be disposed/cancelled.
abstract void setDisposable(Disposable s)
Sets a Disposable on this emitter; any previous Disposable or Cancellation will be disposed/cancelled.
abstract boolean tryOnError(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.
[Expand]
Inherited Methods
From interface io.reactivex.Emitter

Public Methods

public abstract boolean isCancelled ()

Returns true if the downstream cancelled the sequence.

This method is thread-safe.

Returns
  • true if the downstream cancelled the sequence

public abstract long requested ()

The current outstanding request amount.

This method is thread-safe.

Returns
  • the current outstanding request amount

public abstract FlowableEmitter<T> serialize ()

Ensures that calls to onNext, onError and onComplete are properly serialized.

Returns
  • the serialized FlowableEmitter

public abstract void setCancellable (Cancellable c)

Sets a Cancellable on this emitter; any previous Disposable or Cancellation will be disposed/cancelled.

Parameters
c the cancellable resource, null is allowed

public abstract void setDisposable (Disposable s)

Sets a Disposable on this emitter; any previous Disposable or Cancellation will be disposed/cancelled.

Parameters
s the disposable, null is allowed

public abstract boolean tryOnError (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.

Unlike onError(Throwable), the RxJavaPlugins.onError is not called if the error could not be delivered.

Parameters
t the throwable error to signal if possible
Returns
  • true if successful, false if the downstream is not able to accept further events