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>, Processor<T,R>, Publisher<R>, Subscriber<T>
@NullUnmarked
public abstract class SingleSubscriberProcessor<T,R>
extends CompletionAwareSubscriber<T>
implements Processor<T,R>
A Processor that only allows a single Subscriber
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
FieldsFields inherited from class CompletionAwareSubscriber
subscription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Optional<Subscriber<? super R>> Get the currentSubscriber.protected voidCalled afterdoOnComplete()completes.protected voiddoAfterOnError(Throwable throwable) Called afterdoOnError(Throwable)completes.protected voiddoAfterOnSubscribe(Subscription subscription) Called afterdoOnSubscribe(Subscription)completes.protected voidImplementSubscriber.onComplete().protected final voidImplementSubscriber.onError(Throwable).protected final voiddoOnSubscribe(Subscription subscription) ImplementSubscriber.onSubscribe(Subscription).protected voiddoOnSubscribe(Subscription subscription, Subscriber<? super R> subscriber) Perform the actual subscription to the subscriber.protected abstract voiddoSubscribe(Subscriber<? super R> subscriber) Override to implementPublisher.subscribe(Subscriber).protected Subscriber<? super R> Get the currentSubscriber.final voidsubscribe(Subscriber<? super R> subscriber) Methods inherited from class CompletionAwareSubscriber
doOnNext, isComplete, onComplete, onError, onNext, onSubscribeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Subscriber
onComplete, onError, onNext, onSubscribe
-
Field Details
-
EMPTY_SUBSCRIPTION
-
parentSubscription
-
-
Constructor Details
-
SingleSubscriberProcessor
public SingleSubscriberProcessor()
-
-
Method Details
-
subscribe
-
doSubscribe
Override to implementPublisher.subscribe(Subscriber).- Parameters:
subscriber- The subscriber- See Also:
-
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
Called afterdoOnSubscribe(Subscription)completes.- Parameters:
subscription- subscription
-
doOnSubscribe
Perform the actual subscription to the subscriber.- Parameters:
subscription- The subscriptionsubscriber- The subscriber (never null)
-
doOnSubscribe
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>
-