I
- the input value typeO
- the output value typepublic abstract class MultiSubscriptionSubscriber<I,O> extends java.lang.Object implements org.reactivestreams.Subscription, org.reactivestreams.Subscriber<I>, Producer, Cancellable, Requestable, Receiver, Completable
The class is thread safe but switching Subscriptions should happen only when the source associated with the current Subscription has finished emitting values. Otherwise, two sources may emit for one request.
You should call produced(long)
or producedOne()
after each element has been delivered to properly
account the outstanding request amount in case a Subscription switch happens.
Modifier and Type | Field and Description |
---|---|
protected org.reactivestreams.Subscriber<? super O> |
subscriber |
protected boolean |
unbounded |
Constructor and Description |
---|
MultiSubscriptionSubscriber(org.reactivestreams.Subscriber<? super O> subscriber) |
Modifier and Type | Method and Description |
---|---|
void |
cancel() |
org.reactivestreams.Subscriber<? super O> |
downstream()
Return the direct data receiver.
|
boolean |
isCancelled() |
boolean |
isStarted()
Has this upstream started or "onSubscribed" ?
|
boolean |
isTerminated()
Has this upstream finished or "completed" / "failed" ?
|
boolean |
isUnbounded() |
void |
onComplete() |
void |
onError(java.lang.Throwable t) |
void |
onSubscribe(org.reactivestreams.Subscription s) |
void |
produced(long n) |
void |
producedOne() |
void |
request(long n) |
long |
requestedFromDownstream()
Return defined element capacity, used to drive new
Subscription request needs. |
void |
set(org.reactivestreams.Subscription s) |
protected boolean |
shouldCancelCurrent() |
org.reactivestreams.Subscription |
upstream()
Return the direct source of data, Supports reference.
|
protected final org.reactivestreams.Subscriber<? super O> subscriber
protected boolean unbounded
public MultiSubscriptionSubscriber(org.reactivestreams.Subscriber<? super O> subscriber)
public void onSubscribe(org.reactivestreams.Subscription s)
onSubscribe
in interface org.reactivestreams.Subscriber<I>
public void onError(java.lang.Throwable t)
onError
in interface org.reactivestreams.Subscriber<I>
public void onComplete()
onComplete
in interface org.reactivestreams.Subscriber<I>
public final void set(org.reactivestreams.Subscription s)
public final void request(long n)
request
in interface org.reactivestreams.Subscription
public final void producedOne()
public final void produced(long n)
public void cancel()
cancel
in interface org.reactivestreams.Subscription
public final boolean isCancelled()
isCancelled
in interface Cancellable
public final org.reactivestreams.Subscriber<? super O> downstream()
Producer
downstream
in interface Producer
public final org.reactivestreams.Subscription upstream()
Receiver
public final long requestedFromDownstream()
Requestable
Subscription
request needs. This
is the maximum in-flight data allowed to transit to this elements.requestedFromDownstream
in interface Requestable
public boolean isTerminated()
Completable
isTerminated
in interface Completable
public boolean isStarted()
Completable
isStarted
in interface Completable
public final boolean isUnbounded()
protected boolean shouldCancelCurrent()