T
- The argument typeR
- The message typepublic abstract class SingleThreadedBufferingProcessor<R,T> extends SingleThreadedBufferingSubscriber<R> implements Processor<R,T>
A Reactive streams Processor
designed to be used within a single thread and manage
back pressure state.
This processor only supports a single Subscriber
SingleThreadedBufferingSubscriber.BackPressureState, SingleThreadedBufferingSubscriber.DownstreamSubscription
upstreamBuffer, upstreamDemand, upstreamState, upstreamSubscription
Constructor and Description |
---|
SingleThreadedBufferingProcessor() |
Modifier and Type | Method and Description |
---|---|
protected Optional<Subscriber<? super T>> |
currentDownstreamSubscriber()
Resolve the current
Subscriber . |
protected void |
doOnComplete()
Implement
Subscriber.onComplete() . |
protected void |
doOnError(Throwable t)
Implement
Subscriber.onError(Throwable) . |
protected void |
doOnNext(R message)
Implement
Subscriber.onNext(Object) . |
protected void |
doOnSubscribe(Subscription subscription)
Implement
Subscriber.onSubscribe(Subscription) . |
protected Subscriber<? super T> |
getDownstreamSubscriber()
Resolve the current
Subscriber . |
protected abstract void |
onUpstreamMessage(R message)
Called when an message is received from the upstream
Subscriber . |
void |
subscribe(Subscriber<? super T> downstreamSubscriber) |
protected void |
subscribeDownstream(Subscriber<? super T> downstreamSubscriber) |
newDownstreamSubscription, onComplete, onError, onNext, onSubscribe, provideDownstreamSubscription
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onComplete, onError, onNext, onSubscribe
public void subscribe(Subscriber<? super T> downstreamSubscriber)
protected void doOnComplete()
SingleThreadedBufferingSubscriber
Subscriber.onComplete()
.doOnComplete
in class SingleThreadedBufferingSubscriber<R>
protected void doOnNext(R message)
SingleThreadedBufferingSubscriber
Subscriber.onNext(Object)
.doOnNext
in class SingleThreadedBufferingSubscriber<R>
message
- The messageprotected void doOnSubscribe(Subscription subscription)
SingleThreadedBufferingSubscriber
Subscriber.onSubscribe(Subscription)
.doOnSubscribe
in class SingleThreadedBufferingSubscriber<R>
subscription
- The subscriptionprotected void doOnError(Throwable t)
SingleThreadedBufferingSubscriber
Subscriber.onError(Throwable)
.doOnError
in class SingleThreadedBufferingSubscriber<R>
t
- The throwableprotected void subscribeDownstream(Subscriber<? super T> downstreamSubscriber)
downstreamSubscriber
- The downstream subscriberprotected abstract void onUpstreamMessage(R message)
Subscriber
.message
- The messageprotected Optional<Subscriber<? super T>> currentDownstreamSubscriber()
Subscriber
.Optional
of the subscriberprotected Subscriber<? super T> getDownstreamSubscriber()
Subscriber
.Optional
of the subscriberIllegalStateException
- If no Subscriber
is present