O - outgoing item typepublic abstract class SwitchableSubscriptionSubscriber<O> extends Object implements MultiSubscriber<O>, org.reactivestreams.Subscription
Subscription that allows switching the upstream, dealing with the requests accordingly.
You must invoke emitted(long) after delivered items to manage the request per
subscription consistently.
| Modifier and Type | Field and Description |
|---|---|
protected AtomicReference<org.reactivestreams.Subscription> |
currentUpstream
The current upstream
|
protected MultiSubscriber<? super O> |
downstream
The downstream subscriber
|
| Constructor and Description |
|---|
SwitchableSubscriptionSubscriber(MultiSubscriber<? super O> downstream) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel() |
protected boolean |
cancelUpstreamOnSwitch() |
void |
emitted(long n) |
boolean |
isCancelled() |
void |
onCompletion()
Method called when the upstream emits a
completion terminal event. |
void |
onFailure(Throwable t)
Method called when the upstream emits a
failure terminal event. |
void |
onSubscribe(org.reactivestreams.Subscription s) |
void |
request(long n) |
protected void |
setOrSwitchUpstream(org.reactivestreams.Subscription newUpstream) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonComplete, onError, onItem, onNextprotected final MultiSubscriber<? super O> downstream
protected final AtomicReference<org.reactivestreams.Subscription> currentUpstream
public SwitchableSubscriptionSubscriber(MultiSubscriber<? super O> downstream)
public void cancel()
cancel in interface org.reactivestreams.Subscriptionpublic boolean isCancelled()
public void onCompletion()
MultiSubscribercompletion terminal event.
No further events will be sent even if Subscription.request(long) is invoked again.
onCompletion in interface MultiSubscriber<O>public void onFailure(Throwable t)
MultiSubscriberfailure terminal event.
No further events will be sent even if Subscription.request(long) is invoked again.
onFailure in interface MultiSubscriber<O>t - the failure, must not be null.public void onSubscribe(org.reactivestreams.Subscription s)
onSubscribe in interface org.reactivestreams.Subscriber<O>public void emitted(long n)
public final void request(long n)
request in interface org.reactivestreams.Subscriptionprotected final void setOrSwitchUpstream(org.reactivestreams.Subscription newUpstream)
protected boolean cancelUpstreamOnSwitch()
true if we need to cancel the current subscription when we switch the upstreams.Copyright © 2019–2020 SmallRye. All rights reserved.