Class SingleSubscriberProcessor<T,​R>

  • Type Parameters:
    T - the type of element signaled to the Subscriber
    R - the type of element signaled by the Publisher
    All Implemented Interfaces:
    Completable, Emitter<T>, org.reactivestreams.Processor<T,​R>, org.reactivestreams.Publisher<R>, org.reactivestreams.Subscriber<T>

    public abstract class SingleSubscriberProcessor<T,​R>
    extends CompletionAwareSubscriber<T>
    implements org.reactivestreams.Processor<T,​R>

    A Processor that only allows a single Subscriber

    .
    Since:
    1.0
    • Field Detail

      • EMPTY_SUBSCRIPTION

        protected static final org.reactivestreams.Subscription EMPTY_SUBSCRIPTION
      • parentSubscription

        protected org.reactivestreams.Subscription parentSubscription
    • Constructor Detail

      • SingleSubscriberProcessor

        public SingleSubscriberProcessor()
    • Method Detail

      • subscribe

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

        protected abstract void doSubscribe​(org.reactivestreams.Subscriber<? super R> subscriber)
        Override to implement Publisher.subscribe(Subscriber).
        Parameters:
        subscriber - The subscriber
        See Also:
        Publisher.subscribe(Subscriber)
      • getSubscriber

        protected org.reactivestreams.Subscriber<? super R> getSubscriber()
        Get the current Subscriber.
        Returns:
        The Subscriber
        Throws:
        java.lang.IllegalStateException - if the subscriber is not present
      • currentSubscriber

        protected java.util.Optional<org.reactivestreams.Subscriber<? super R>> currentSubscriber()
        Get the current Subscriber.
        Returns:
        An Optional subscriber
      • doAfterOnError

        protected void doAfterOnError​(java.lang.Throwable throwable)
        Called after doOnError(Throwable) completes.
        Parameters:
        throwable - The error
      • doAfterComplete

        protected void doAfterComplete()
        Called after doOnComplete() completes.
      • doAfterOnSubscribe

        protected void doAfterOnSubscribe​(org.reactivestreams.Subscription subscription)
        Called after doOnSubscribe(Subscription) completes.
        Parameters:
        subscription - subscription
      • doOnSubscribe

        protected void doOnSubscribe​(org.reactivestreams.Subscription subscription,
                                     org.reactivestreams.Subscriber<? super R> subscriber)
        Perform the actual subscription to the subscriber.
        Parameters:
        subscription - The subscription
        subscriber - The subscriber (never null)
      • doOnSubscribe

        protected final void doOnSubscribe​(org.reactivestreams.Subscription subscription)
        Description copied from class: CompletionAwareSubscriber
        Implement Subscriber.onSubscribe(Subscription).
        Specified by:
        doOnSubscribe in class CompletionAwareSubscriber<T>
        Parameters:
        subscription - The subscription