Class SubscriptionArbiter
java.lang.Object
java.lang.Number
java.util.concurrent.atomic.AtomicInteger
io.reactivex.rxjava3.internal.subscriptions.SubscriptionArbiter
- All Implemented Interfaces:
Serializable, org.reactivestreams.Subscription
- Direct Known Subclasses:
FlowableConcatArray.ConcatArraySubscriber, FlowableConcatMap.ConcatMapInner, FlowableOnErrorNext.OnErrorNextSubscriber, FlowableRepeatWhen.WhenSourceSubscriber, FlowableTimeout.TimeoutFallbackSubscriber, FlowableTimeoutTimed.TimeoutFallbackSubscriber
Arbitrates requests and cancellation between Subscriptions.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) org.reactivestreams.SubscriptionThe current subscription which may null if no Subscriptions have been set.(package private) boolean(package private) final boolean(package private) final AtomicLong(package private) final AtomicLong(package private) final AtomicReference<org.reactivestreams.Subscription> (package private) longThe current outstanding request amount.private static final longprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()(package private) final voiddrain()(package private) final voidfinal booleanReturns true if the arbiter has been cancelled.final booleanReturns true if the arbiter runs in unbounded mode.final voidproduced(long n) final voidrequest(long n) final voidsetSubscription(org.reactivestreams.Subscription s) Atomically sets a new subscription.Methods inherited from class AtomicInteger
accumulateAndGet, addAndGet, compareAndExchange, compareAndExchangeAcquire, compareAndExchangeRelease, compareAndSet, decrementAndGet, doubleValue, floatValue, get, getAcquire, getAndAccumulate, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, getAndUpdate, getOpaque, getPlain, incrementAndGet, intValue, lazySet, longValue, set, setOpaque, setPlain, setRelease, toString, updateAndGet, weakCompareAndSet, weakCompareAndSetAcquire, weakCompareAndSetPlain, weakCompareAndSetRelease, weakCompareAndSetVolatileMethods inherited from class Number
byteValue, shortValue
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
actual
org.reactivestreams.Subscription actualThe current subscription which may null if no Subscriptions have been set. -
requested
long requestedThe current outstanding request amount. -
missedSubscription
-
missedRequested
-
missedProduced
-
cancelOnReplace
final boolean cancelOnReplace -
cancelled
volatile boolean cancelled -
unbounded
protected boolean unbounded
-
-
Constructor Details
-
SubscriptionArbiter
public SubscriptionArbiter(boolean cancelOnReplace)
-
-
Method Details
-
setSubscription
public final void setSubscription(org.reactivestreams.Subscription s) Atomically sets a new subscription.- Parameters:
s- the subscription to set, not null (verified)
-
request
public final void request(long n) - Specified by:
requestin interfaceorg.reactivestreams.Subscription
-
produced
public final void produced(long n) -
cancel
public void cancel()- Specified by:
cancelin interfaceorg.reactivestreams.Subscription
-
drain
final void drain() -
drainLoop
final void drainLoop() -
isUnbounded
public final boolean isUnbounded()Returns true if the arbiter runs in unbounded mode.- Returns:
- true if the arbiter runs in unbounded mode
-
isCancelled
public final boolean isCancelled()Returns true if the arbiter has been cancelled.- Returns:
- true if the arbiter has been cancelled
-