Class AbstractListenerWriteFlushProcessor<T>

  • Type Parameters:
    T - the type of element signaled to the Subscriber
    All Implemented Interfaces:
    org.reactivestreams.Processor<org.reactivestreams.Publisher<? extends T>,​Void>, org.reactivestreams.Publisher<Void>, org.reactivestreams.Subscriber<org.reactivestreams.Publisher<? extends T>>

    public abstract class AbstractListenerWriteFlushProcessor<T>
    extends Object
    implements org.reactivestreams.Processor<org.reactivestreams.Publisher<? extends T>,​Void>
    An alternative to AbstractListenerWriteProcessor but instead writing a Publisher<Publisher<T>> with flush boundaries enforces after the completion of each nested Publisher.
    Since:
    5.0
    Author:
    Arjen Poutsma, Violeta Georgieva, Rossen Stoyanchev
    • Method Detail

      • getLogPrefix

        public String getLogPrefix()
        Create an instance with the given log prefix.
        Since:
        5.1
      • onSubscribe

        public final void onSubscribe​(org.reactivestreams.Subscription subscription)
        Specified by:
        onSubscribe in interface org.reactivestreams.Subscriber<T>
      • onNext

        public final void onNext​(org.reactivestreams.Publisher<? extends T> publisher)
        Specified by:
        onNext in interface org.reactivestreams.Subscriber<T>
      • onError

        public final void onError​(Throwable ex)
        Error signal from the upstream, write Publisher. This is also used by sub-classes to delegate error notifications from the container.
        Specified by:
        onError in interface org.reactivestreams.Subscriber<T>
      • onComplete

        public final void onComplete()
        Completion signal from the upstream, write Publisher. This is also used by sub-classes to delegate completion notifications from the container.
        Specified by:
        onComplete in interface org.reactivestreams.Subscriber<T>
      • onFlushPossible

        protected final void onFlushPossible()
        Invoked when flushing is possible, either in the same thread after a check via isWritePossible(), or as a callback from the underlying container.
      • cancel

        protected void cancel()
        Invoked during an error or completion callback from the underlying container to cancel the upstream subscription.
      • subscribe

        public final void subscribe​(org.reactivestreams.Subscriber<? super Void> subscriber)
        Specified by:
        subscribe in interface org.reactivestreams.Publisher<T>
      • createWriteProcessor

        protected abstract org.reactivestreams.Processor<? super T,​VoidcreateWriteProcessor()
        Create a new processor for the current flush boundary.
      • isWritePossible

        protected abstract boolean isWritePossible()
        Whether writing/flushing is possible.
      • flush

        protected abstract void flush()
                               throws IOException
        Flush the output if ready, or otherwise isFlushPending() should return true after.

        This is primarily for the Servlet non-blocking I/O API where flush cannot be called without a readyToWrite check.

        Throws:
        IOException
      • isFlushPending

        protected abstract boolean isFlushPending()
        Whether flushing is pending.

        This is primarily for the Servlet non-blocking I/O API where flush cannot be called without a readyToWrite check.

      • flushingFailed

        protected void flushingFailed​(Throwable t)
        Invoked when an error happens while flushing. Sub-classes may choose to ignore this if they know the underlying API will provide an error notification in a container thread.

        Defaults to no-op.