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 theSubscriber
R
- the type of element signaled by thePublisher
- All Implemented Interfaces:
Completable
,Emitter<T>
,Processor<T,
,R> Publisher<R>
,Subscriber<T>
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
Fields inherited from class io.micronaut.core.async.subscriber.CompletionAwareSubscriber
subscription
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Optional<Subscriber<? super R>>
Get the currentSubscriber
.protected void
Called afterdoOnComplete()
completes.protected void
doAfterOnError
(Throwable throwable) Called afterdoOnError(Throwable)
completes.protected void
doAfterOnSubscribe
(Subscription subscription) Called afterdoOnSubscribe(Subscription)
completes.protected void
ImplementSubscriber.onComplete()
.protected final void
ImplementSubscriber.onError(Throwable)
.protected final void
doOnSubscribe
(Subscription subscription) ImplementSubscriber.onSubscribe(Subscription)
.protected void
doOnSubscribe
(Subscription subscription, Subscriber<? super R> subscriber) Perform the actual subscription to the subscriber.protected abstract void
doSubscribe
(Subscriber<? super R> subscriber) Override to implementPublisher.subscribe(Subscriber)
.protected Subscriber<? super R>
Get the currentSubscriber
.final void
subscribe
(Subscriber<? super R> subscriber) Methods inherited from class io.micronaut.core.async.subscriber.CompletionAwareSubscriber
doOnNext, isComplete, onComplete, onError, onNext, onSubscribe
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.reactivestreams.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
Optional
subscriber
-
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:CompletionAwareSubscriber
ImplementSubscriber.onSubscribe(Subscription)
.- Specified by:
doOnSubscribe
in classCompletionAwareSubscriber<T>
- Parameters:
subscription
- The subscription
-
doOnError
Description copied from class:CompletionAwareSubscriber
ImplementSubscriber.onError(Throwable)
.- Specified by:
doOnError
in classCompletionAwareSubscriber<T>
- Parameters:
t
- The throwable
-
doOnComplete
protected void doOnComplete()Description copied from class:CompletionAwareSubscriber
ImplementSubscriber.onComplete()
.- Specified by:
doOnComplete
in classCompletionAwareSubscriber<T>
-