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 theSubscriberR- the type of element signaled by thePublisher
- 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 Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.reactivestreams.Subscriptionprotected org.reactivestreams.SubscriptionFields inherited from class io.micronaut.core.async.subscriber.CompletionAwareSubscriber
subscription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the currentSubscriber.protected voidCalled afterdoOnComplete()completes.protected voiddoAfterOnError(Throwable throwable) Called afterdoOnError(Throwable)completes.protected voiddoAfterOnSubscribe(org.reactivestreams.Subscription subscription) Called afterdoOnSubscribe(Subscription)completes.protected voidImplementSubscriber.onComplete().protected final voidImplementSubscriber.onError(Throwable).protected final voiddoOnSubscribe(org.reactivestreams.Subscription subscription) ImplementSubscriber.onSubscribe(Subscription).protected voiddoOnSubscribe(org.reactivestreams.Subscription subscription, org.reactivestreams.Subscriber<? super R> subscriber) Perform the actual subscription to the subscriber.protected abstract voiddoSubscribe(org.reactivestreams.Subscriber<? super R> subscriber) Override to implementPublisher.subscribe(Subscriber).protected org.reactivestreams.Subscriber<? super R>Get the currentSubscriber.final voidMethods inherited from class io.micronaut.core.async.subscriber.CompletionAwareSubscriber
doOnNext, isComplete, onComplete, onError, onNext, onSubscribeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.reactivestreams.Subscriber
onComplete, onError, onNext, onSubscribe
-
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
- Specified by:
subscribein interfaceorg.reactivestreams.Publisher<T>
-
doSubscribe
Override to implementPublisher.subscribe(Subscriber).- Parameters:
subscriber- The subscriber- See Also:
-
Publisher.subscribe(Subscriber)
-
getSubscriber
Get the currentSubscriber.- Returns:
- The
Subscriber - Throws:
IllegalStateException- if the subscriber is not present
-
currentSubscriber
Get the currentSubscriber.- Returns:
- An
Optionalsubscriber
-
doAfterOnError
Called afterdoOnError(Throwable)completes.- Parameters:
throwable- The error
-
doAfterComplete
protected void doAfterComplete()Called afterdoOnComplete()completes. -
doAfterOnSubscribe
protected void doAfterOnSubscribe(org.reactivestreams.Subscription subscription) Called afterdoOnSubscribe(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 subscriptionsubscriber- The subscriber (never null)
-
doOnSubscribe
protected final void doOnSubscribe(org.reactivestreams.Subscription subscription) Description copied from class:CompletionAwareSubscriberImplementSubscriber.onSubscribe(Subscription).- Specified by:
doOnSubscribein classCompletionAwareSubscriber<T>- Parameters:
subscription- The subscription
-
doOnError
Description copied from class:CompletionAwareSubscriberImplementSubscriber.onError(Throwable).- Specified by:
doOnErrorin classCompletionAwareSubscriber<T>- Parameters:
t- The throwable
-
doOnComplete
protected void doOnComplete()Description copied from class:CompletionAwareSubscriberImplementSubscriber.onComplete().- Specified by:
doOnCompletein classCompletionAwareSubscriber<T>
-