Class FlowableProcessors


  • public final class FlowableProcessors
    extends java.lang.Object
    Utility methods to work with Reactive-Streams Processors and RxJava 2 FlowableProcessors.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> @NonNull FlowableProcessor<T> refCount​(FlowableProcessor<T> processor)
      Wraps a FlowableProcessor and makes sure if all subscribers cancel their subscriptions, the upstream's Subscription gets cancelled as well.
      static <T> FlowableProcessor<T> wrap​(Processor<T,​T> processor)
      Wraps an arbitrary Reactive-Streams Processor into a FlowableProcessor, relaying the onXXX and subscribe() calls to it and providing a rich fluent API on top.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • wrap

        public static <T> FlowableProcessor<T> wrap​(Processor<T,​T> processor)
        Wraps an arbitrary Reactive-Streams Processor into a FlowableProcessor, relaying the onXXX and subscribe() calls to it and providing a rich fluent API on top.

        Note that RxJava 2 doesn't support a FlowableProcessor with different input and output types.

        Type Parameters:
        T - the input and output type
        Parameters:
        processor - the processor to wrap (or return if already a FlowableProcessor), not null
        Returns:
        the FlowableProcessor instance possible wrapping the input processor
      • refCount

        @NonNull
        @CheckReturnValue
        public static <T> @NonNull FlowableProcessor<T> refCount​(FlowableProcessor<T> processor)
        Wraps a FlowableProcessor and makes sure if all subscribers cancel their subscriptions, the upstream's Subscription gets cancelled as well.

        This operator is similar to ConnectableFlowable.refCount() except the first Subscriber doesn't trigger any sort of connection; that happens when the resulting FlowableProcessor is subscribed to a Publisher manually.

        Type Parameters:
        T - the input and output value type
        Parameters:
        processor - the processor to wrap, not null
        Returns:
        the wrapped and reference-counted FlowableProcessor
        Since:
        0.18.2