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.Subscription
The 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) long
The current outstanding request amount.private static final long
protected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
(package private) final void
drain()
(package private) final void
final boolean
Returns true if the arbiter has been cancelled.final boolean
Returns true if the arbiter runs in unbounded mode.final void
produced
(long n) final void
request
(long n) final void
setSubscription
(org.reactivestreams.Subscription s) Atomically sets a new subscription.Methods inherited from class java.util.concurrent.atomic.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, weakCompareAndSetVolatile
Methods inherited from class java.lang.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:
request
in interfaceorg.reactivestreams.Subscription
-
produced
public final void produced(long n) -
cancel
public void cancel()- Specified by:
cancel
in 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
-