Class SingleSubscriberProcessor<T,R>

java.lang.Object
io.micronaut.core.async.subscriber.CompletionAwareSubscriber<T>
io.micronaut.core.async.processor.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 Details

    • EMPTY_SUBSCRIPTION

      protected static final org.reactivestreams.Subscription EMPTY_SUBSCRIPTION
    • parentSubscription

      protected org.reactivestreams.Subscription parentSubscription
  • Constructor Details

    • SingleSubscriberProcessor

      public SingleSubscriberProcessor()
  • Method Details

    • 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:
      IllegalStateException - if the subscriber is not present
    • currentSubscriber

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

      protected void doAfterOnError(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
    • doOnError

      protected final void doOnError(Throwable t)
      Description copied from class: CompletionAwareSubscriber
      Implement Subscriber.onError(Throwable).
      Specified by:
      doOnError in class CompletionAwareSubscriber<T>
      Parameters:
      t - The throwable
    • doOnComplete

      protected void doOnComplete()
      Description copied from class: CompletionAwareSubscriber
      Implement Subscriber.onComplete().
      Specified by:
      doOnComplete in class CompletionAwareSubscriber<T>