Class FlowableProcessor<T>

java.lang.Object
io.reactivex.rxjava3.core.Flowable<T>
io.reactivex.rxjava3.processors.FlowableProcessor<T>
Type Parameters:
T - the item value type
All Implemented Interfaces:
FlowableSubscriber<T>, org.reactivestreams.Processor<T,T>, org.reactivestreams.Publisher<T>, org.reactivestreams.Subscriber<T>
Direct Known Subclasses:
AsyncProcessor, BehaviorProcessor, MulticastProcessor, PublishProcessor, ReplayProcessor, SerializedProcessor, UnicastProcessor

public abstract class FlowableProcessor<@NonNull T> extends Flowable<T> implements org.reactivestreams.Processor<T,T>, FlowableSubscriber<T>
Represents a Subscriber and a Flowable (Publisher) at the same time, allowing multicasting events from a single source to multiple child Subscribers.

All methods except the onSubscribe, onNext, onError and onComplete are thread-safe. Use toSerialized() to make these methods thread-safe as well.

  • Constructor Details

    • FlowableProcessor

      public FlowableProcessor()
  • Method Details

    • hasSubscribers

      @CheckReturnValue public abstract boolean hasSubscribers()
      Returns true if the FlowableProcessor has subscribers.

      The method is thread-safe.

      Returns:
      true if the FlowableProcessor has subscribers
    • hasThrowable

      @CheckReturnValue public abstract boolean hasThrowable()
      Returns true if the FlowableProcessor has reached a terminal state through an error event.

      The method is thread-safe.

      Returns:
      true if the FlowableProcessor has reached a terminal state through an error event
      See Also:
    • hasComplete

      @CheckReturnValue public abstract boolean hasComplete()
      Returns true if the FlowableProcessor has reached a terminal state through a complete event.

      The method is thread-safe.

      Returns:
      true if the FlowableProcessor has reached a terminal state through a complete event
      See Also:
    • getThrowable

      @Nullable @CheckReturnValue public abstract @Nullable Throwable getThrowable()
      Returns the error that caused the FlowableProcessor to terminate or null if the FlowableProcessor hasn't terminated yet.

      The method is thread-safe.

      Returns:
      the error that caused the FlowableProcessor to terminate or null if the FlowableProcessor hasn't terminated yet
    • toSerialized

      @NonNull @CheckReturnValue public final @NonNull FlowableProcessor<T> toSerialized()
      Wraps this FlowableProcessor and serializes the calls to the onSubscribe, onNext, onError and onComplete methods, making them thread-safe.

      The method is thread-safe.

      Returns:
      the wrapped and serialized FlowableProcessor