T
- The typepublic abstract class SingleThreadedBufferingSubscriber<T> extends java.lang.Object implements org.reactivestreams.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 java.util.Queue<T> |
upstreamBuffer |
protected long |
upstreamDemand |
protected SingleThreadedBufferingSubscriber.BackPressureState |
upstreamState |
protected org.reactivestreams.Subscription |
upstreamSubscription |
Constructor and Description |
---|
SingleThreadedBufferingSubscriber() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
doOnComplete()
Implement
Subscriber.onComplete() . |
protected abstract void |
doOnError(java.lang.Throwable t)
Implement
Subscriber.onError(Throwable) . |
protected abstract void |
doOnNext(T message)
Implement
Subscriber.onNext(Object) . |
protected abstract void |
doOnSubscribe(org.reactivestreams.Subscription subscription)
Implement
Subscriber.onSubscribe(Subscription) . |
protected org.reactivestreams.Subscription |
newDownstreamSubscription() |
void |
onComplete()
* Successful terminal state.
|
void |
onError(java.lang.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(org.reactivestreams.Subscription subscription) |
protected void |
provideDownstreamSubscription(org.reactivestreams.Subscriber subscriber) |
protected final java.util.Queue<T> upstreamBuffer
protected SingleThreadedBufferingSubscriber.BackPressureState upstreamState
protected long upstreamDemand
protected org.reactivestreams.Subscription upstreamSubscription
public final void onSubscribe(org.reactivestreams.Subscription subscription)
onSubscribe
in interface org.reactivestreams.Subscriber<T>
public final void onComplete()
Completable
onComplete
in interface Completable
onComplete
in interface org.reactivestreams.Subscriber<T>
Subscriber.onComplete()
public final void onNext(T message)
Emitter
Publisher
in response to requests to Subscription.request(long)
.public final void onError(java.lang.Throwable t)
Emitter
No further events will be sent even if Subscription.request(long)
is invoked again.
protected abstract void doOnSubscribe(org.reactivestreams.Subscription subscription)
Subscriber.onSubscribe(Subscription)
.subscription
- The subscriptionprotected abstract void doOnNext(T message)
Subscriber.onNext(Object)
.message
- The messageprotected abstract void doOnError(java.lang.Throwable t)
Subscriber.onError(Throwable)
.t
- The throwableprotected abstract void doOnComplete()
Subscriber.onComplete()
.protected void provideDownstreamSubscription(org.reactivestreams.Subscriber subscriber)
subscriber
- The subscriberprotected org.reactivestreams.Subscription newDownstreamSubscription()