T - the type that the delegate subscriber demands.U - the type sent by the publisher this subscriber is subscribed to.public abstract class BaseSubscriberAdapter<T,U> extends DelegatingSubscriber<T,U>
U type,
but will need to fulfill the downstream demand of the delegate
subscriber with instance of the T type.| Modifier and Type | Field and Description |
|---|---|
protected AtomicLong |
downstreamDemand
The amount of unfulfilled demand the downstream subscriber has opened against us.
|
protected AtomicBoolean |
handlingStateUpdate
A flag that is used to ensure that only one thread is handling updates to the state of this subscriber at a time.
|
protected boolean |
onCompleteCalledByUpstream
Whether the upstream subscriber has called onComplete on us.
|
protected AtomicReference<Throwable> |
onErrorFromUpstream
Whether the upstream subscriber has called onError on us.
|
protected boolean |
terminalCallMadeDownstream
Whether we have called onComplete or onNext on the downstream subscriber.
|
protected AtomicLong |
upstreamDemand
The amount of unfulfilled demand open against the upstream subscriber.
|
protected org.reactivestreams.Subscription |
upstreamSubscription
The subscription to the upstream subscriber.
|
subscriber| Modifier | Constructor and Description |
|---|---|
protected |
BaseSubscriberAdapter(org.reactivestreams.Subscriber<? super U> subscriber) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
fulfillDownstreamDemand()
This method is called when demand from the downstream subscriber needs to be fulfilled.
|
protected void |
handleStateUpdate()
This is invoked after each downstream request or upstream onNext, onError or onComplete.
|
void |
onComplete() |
void |
onError(Throwable throwable) |
void |
onNext(T item) |
void |
onSubscribe(org.reactivestreams.Subscription subscription) |
protected final AtomicLong upstreamDemand
protected final AtomicLong downstreamDemand
protected final AtomicBoolean handlingStateUpdate
protected final AtomicReference<Throwable> onErrorFromUpstream
protected volatile boolean terminalCallMadeDownstream
protected volatile boolean onCompleteCalledByUpstream
protected org.reactivestreams.Subscription upstreamSubscription
protected BaseSubscriberAdapter(org.reactivestreams.Subscriber<? super U> subscriber)
protected abstract void fulfillDownstreamDemand()
downstreamDemand is no longer needed. Implementations are responsible for decrementing the downstreamDemand accordingly as demand gets fulfilled.public void onSubscribe(org.reactivestreams.Subscription subscription)
onSubscribe in interface org.reactivestreams.Subscriber<T>onSubscribe in class DelegatingSubscriber<T,U>public void onNext(T item)
public void onError(Throwable throwable)
onError in interface org.reactivestreams.Subscriber<T>onError in class DelegatingSubscriber<T,U>public void onComplete()
onComplete in interface org.reactivestreams.Subscriber<T>onComplete in class DelegatingSubscriber<T,U>protected void handleStateUpdate()
Copyright © 2026. All rights reserved.