T
- The typepublic abstract class SingleThreadedBufferingSubscriber<T> extends Object implements Subscriber<T>, Emitter<T>
Subscriber
designed to be used by a single thread that buffers incoming data for the purposes of managing
back pressure.Modifier and Type | Class and Description |
---|---|
protected static class |
SingleThreadedBufferingSubscriber.BackPressureState
Back pressure state.
|
protected class |
SingleThreadedBufferingSubscriber.DownstreamSubscription
A downstream subscription.
|
Modifier and Type | Field and Description |
---|---|
protected Queue<T> |
upstreamBuffer |
protected long |
upstreamDemand |
protected SingleThreadedBufferingSubscriber.BackPressureState |
upstreamState |
protected Subscription |
upstreamSubscription |
Constructor and Description |
---|
SingleThreadedBufferingSubscriber() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
doOnComplete()
Implement
Subscriber.onComplete() . |
protected abstract void |
doOnError(Throwable t)
Implement
Subscriber.onError(Throwable) . |
protected abstract void |
doOnNext(T message)
Implement
Subscriber.onNext(Object) . |
protected abstract void |
doOnSubscribe(Subscription subscription)
Implement
Subscriber.onSubscribe(Subscription) . |
protected Subscription |
newDownstreamSubscription() |
void |
onComplete()
* Successful terminal state.
|
void |
onError(Throwable t)
Failed terminal state.
|
void |
onNext(T message)
Data notification sent by the
Publisher in response to requests to Subscription.request(long) . |
void |
onSubscribe(Subscription subscription) |
protected void |
provideDownstreamSubscription(Subscriber subscriber) |
protected SingleThreadedBufferingSubscriber.BackPressureState upstreamState
protected long upstreamDemand
protected Subscription upstreamSubscription
public final void onSubscribe(Subscription subscription)
onSubscribe
in interface Subscriber<T>
public final void onComplete()
Completable
onComplete
in interface Completable
onComplete
in interface Subscriber<T>
Subscriber.onComplete()
public final void onNext(T message)
Emitter
Publisher
in response to requests to Subscription.request(long)
.public final void onError(Throwable t)
Emitter
No further events will be sent even if Subscription.request(long)
is invoked again.
protected abstract void doOnSubscribe(Subscription subscription)
Subscriber.onSubscribe(Subscription)
.subscription
- The subscriptionprotected abstract void doOnNext(T message)
Subscriber.onNext(Object)
.message
- The messageprotected abstract void doOnError(Throwable t)
Subscriber.onError(Throwable)
.t
- The throwableprotected abstract void doOnComplete()
Subscriber.onComplete()
.protected void provideDownstreamSubscription(Subscriber subscriber)
subscriber
- The subscriberprotected Subscription newDownstreamSubscription()