T
- the type of element signaled to the Subscriber
R
- the type of element signaled by the Publisher
public abstract class SingleSubscriberProcessor<T,R> extends CompletionAwareSubscriber<T> implements Processor<T,R>
A Processor
that only allows a single Subscriber
Modifier and Type | Field and Description |
---|---|
protected static Subscription |
EMPTY_SUBSCRIPTION |
protected Subscription |
parentSubscription |
subscription
Constructor and Description |
---|
SingleSubscriberProcessor() |
Modifier and Type | Method and Description |
---|---|
protected Optional<Subscriber<? super R>> |
currentSubscriber()
Get the current
Subscriber . |
protected void |
doAfterComplete()
Called after
doOnComplete() completes. |
protected void |
doAfterOnError(Throwable throwable)
Called after
doOnError(Throwable) completes. |
protected void |
doAfterOnSubscribe(Subscription subscription)
Called after
doOnSubscribe(Subscription) completes. |
protected void |
doOnComplete()
Implement
Subscriber.onComplete() . |
protected void |
doOnError(Throwable t)
Implement
Subscriber.onError(Throwable) . |
protected void |
doOnSubscribe(Subscription subscription)
Implement
Subscriber.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 implement
Publisher.subscribe(Subscriber) . |
protected Subscriber<? super R> |
getSubscriber()
Get the current
Subscriber . |
void |
subscribe(Subscriber<? super R> subscriber) |
doOnNext, isComplete, onComplete, onError, onNext, onSubscribe
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onComplete, onError, onNext, onSubscribe
protected static final Subscription EMPTY_SUBSCRIPTION
protected Subscription parentSubscription
public final void subscribe(Subscriber<? super R> subscriber)
protected abstract void doSubscribe(Subscriber<? super R> subscriber)
Publisher.subscribe(Subscriber)
.subscriber
- The subscriberPublisher.subscribe(Subscriber)
protected Subscriber<? super R> getSubscriber()
Subscriber
.Subscriber
IllegalStateException
- if the subscriber is not presentprotected Optional<Subscriber<? super R>> currentSubscriber()
Subscriber
.Optional
subscriberprotected void doAfterOnError(Throwable throwable)
doOnError(Throwable)
completes.throwable
- The errorprotected void doAfterComplete()
doOnComplete()
completes.protected void doAfterOnSubscribe(Subscription subscription)
doOnSubscribe(Subscription)
completes.subscription
- subscriptionprotected void doOnSubscribe(Subscription subscription, Subscriber<? super R> subscriber)
subscription
- The subscriptionsubscriber
- The subscriber (never null)protected final void doOnSubscribe(Subscription subscription)
CompletionAwareSubscriber
Subscriber.onSubscribe(Subscription)
.doOnSubscribe
in class CompletionAwareSubscriber<T>
subscription
- The subscriptionprotected final void doOnError(Throwable t)
CompletionAwareSubscriber
Subscriber.onError(Throwable)
.doOnError
in class CompletionAwareSubscriber<T>
t
- The throwableprotected void doOnComplete()
CompletionAwareSubscriber
Subscriber.onComplete()
.doOnComplete
in class CompletionAwareSubscriber<T>