Class SerializedProcessor<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>

    final class SerializedProcessor<T>
    extends FlowableProcessor<T>
    Serializes calls to the Subscriber methods.

    All other Publisher and Subject methods are thread-safe by design.

    • Field Detail

      • actual

        final FlowableProcessor<T> actual
        The actual subscriber to serialize Subscriber calls to.
      • emitting

        boolean emitting
        Indicates an emission is going on, guarded by this.
      • done

        volatile boolean done
        Indicates a terminal event has been received and all further events will be dropped.
    • Constructor Detail

      • SerializedProcessor

        SerializedProcessor​(FlowableProcessor<T> actual)
        Constructor that wraps an actual subject.
        Parameters:
        actual - the subject wrapped
    • Method Detail

      • subscribeActual

        protected void subscribeActual​(org.reactivestreams.Subscriber<? super T> s)
        Description copied from class: Flowable
        Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic and handles the incoming Subscribers.

        There is no need to call any of the plugin hooks on the current Flowable instance or the Subscriber; all hooks and basic safeguards have been applied by Flowable.subscribe(Subscriber) before this method gets called.

        Specified by:
        subscribeActual in class Flowable<T>
        Parameters:
        s - the incoming Subscriber, never null
      • onSubscribe

        public void onSubscribe​(org.reactivestreams.Subscription s)
        Description copied from interface: FlowableSubscriber
        Implementors of this method should make sure everything that needs to be visible in Subscriber.onNext(Object) is established before calling Subscription.request(long). In practice this means no initialization should happen after the request() call and additional behavior is thread safe in respect to onNext.
      • onNext

        public void onNext​(T t)
      • onError

        public void onError​(java.lang.Throwable t)
      • onComplete

        public void onComplete()
      • emitLoop

        void emitLoop()
        Loops until all notifications in the queue has been processed.
      • hasSubscribers

        public boolean hasSubscribers()
        Description copied from class: FlowableProcessor
        Returns true if the FlowableProcessor has subscribers.

        The method is thread-safe.

        Specified by:
        hasSubscribers in class FlowableProcessor<T>
        Returns:
        true if the FlowableProcessor has subscribers
      • getThrowable

        @Nullable
        public @Nullable java.lang.Throwable getThrowable()
        Description copied from class: FlowableProcessor
        Returns the error that caused the FlowableProcessor to terminate or null if the FlowableProcessor hasn't terminated yet.

        The method is thread-safe.

        Specified by:
        getThrowable in class FlowableProcessor<T>
        Returns:
        the error that caused the FlowableProcessor to terminate or null if the FlowableProcessor hasn't terminated yet
      • hasComplete

        public boolean hasComplete()
        Description copied from class: FlowableProcessor
        Returns true if the FlowableProcessor has reached a terminal state through a complete event.

        The method is thread-safe.

        Specified by:
        hasComplete in class FlowableProcessor<T>
        Returns:
        true if the FlowableProcessor has reached a terminal state through a complete event
        See Also:
        FlowableProcessor.hasThrowable()