Class SingleThreadedBufferingSubscriber<T>
java.lang.Object
io.micronaut.core.async.subscriber.SingleThreadedBufferingSubscriber<T>
- Type Parameters:
T- The type
- All Implemented Interfaces:
Completable,Emitter<T>,Subscriber<T>
- Direct Known Subclasses:
SingleThreadedBufferingProcessor
public abstract class SingleThreadedBufferingSubscriber<T>
extends Object
implements Subscriber<T>, Emitter<T>
A
Subscriber designed to be used by a single thread that buffers incoming data for the purposes of managing
back pressure.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumBack pressure state.protected classA downstream subscription. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidImplementSubscriber.onComplete().protected abstract voidImplementSubscriber.onError(Throwable).protected abstract voidImplementSubscriber.onNext(Object).protected abstract voiddoOnSubscribe(Subscription subscription) ImplementSubscriber.onSubscribe(Subscription).protected Subscriptionfinal void* Successful terminal state.final voidFailed terminal state.final voidData notification sent by thePublisherin response to requests toSubscription.request(long).final voidonSubscribe(Subscription subscription) protected voidprovideDownstreamSubscription(Subscriber subscriber)
-
Field Details
-
upstreamBuffer
-
upstreamState
-
upstreamDemand
protected long upstreamDemand -
upstreamSubscription
-
-
Constructor Details
-
SingleThreadedBufferingSubscriber
public SingleThreadedBufferingSubscriber()
-
-
Method Details
-
onSubscribe
- Specified by:
onSubscribein interfaceSubscriber<T>
-
onComplete
public final void onComplete()Description copied from interface:Completable* Successful terminal state. To be called when the operation is complete.- Specified by:
onCompletein interfaceCompletable- Specified by:
onCompletein interfaceSubscriber<T>- See Also:
-
onNext
Description copied from interface:EmitterData notification sent by thePublisherin response to requests toSubscription.request(long). -
onError
Description copied from interface:EmitterFailed terminal state.No further events will be sent even if
Subscription.request(long)is invoked again. -
doOnSubscribe
ImplementSubscriber.onSubscribe(Subscription).- Parameters:
subscription- The subscription
-
doOnNext
ImplementSubscriber.onNext(Object).- Parameters:
message- The message
-
doOnError
ImplementSubscriber.onError(Throwable).- Parameters:
t- The throwable
-
doOnComplete
protected abstract void doOnComplete()ImplementSubscriber.onComplete(). -
provideDownstreamSubscription
- Parameters:
subscriber- The subscriber
-
newDownstreamSubscription
- Returns:
- The subscription
-