Class FlowableReplay.InnerSubscription<T>
java.lang.Object
java.lang.Number
java.util.concurrent.atomic.AtomicLong
io.reactivex.rxjava3.internal.operators.flowable.FlowableReplay.InnerSubscription<T>
- Type Parameters:
T
- the value type
- All Implemented Interfaces:
Disposable
,Serializable
,org.reactivestreams.Subscription
- Enclosing class:
FlowableReplay<T>
static final class FlowableReplay.InnerSubscription<T>
extends AtomicLong
implements org.reactivestreams.Subscription, Disposable
A Subscription that manages the request and cancellation state of a
child subscriber in thread-safe manner.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final long
Indicates this child has been cancelled: the state is swapped in atomically and will prevent the dispatch() to emit (too many) values to a terminated child subscriber.(package private) final org.reactivestreams.Subscriber
<? super T> The actual child subscriber.(package private) boolean
Indicates an emission state.(package private) Object
Holds an object that represents the current location in the buffer.(package private) boolean
Indicates a missed update.(package private) final FlowableReplay.ReplaySubscriber
<T> The parent subscriber-to-source used to allow removing the child in case of child cancellation.private static final long
(package private) final AtomicLong
Keeps the sum of all requested amounts. -
Constructor Summary
ConstructorsConstructorDescriptionInnerSubscription
(FlowableReplay.ReplaySubscriber<T> parent, org.reactivestreams.Subscriber<? super T> child) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
void
dispose()
Dispose the resource, the operation should be idempotent.(package private) <U> U
index()
Convenience method to auto-cast the index object.boolean
Returns true if this resource has been disposed.long
produced
(long n) Indicate that values have been emitted to this child subscriber by the dispatch() method.void
request
(long n) Methods inherited from class java.util.concurrent.atomic.AtomicLong
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:
-
parent
The parent subscriber-to-source used to allow removing the child in case of child cancellation. -
child
The actual child subscriber. -
index
Object indexHolds an object that represents the current location in the buffer. Guarded by the emitter loop. -
totalRequested
Keeps the sum of all requested amounts. -
emitting
boolean emittingIndicates an emission state. Guarded by this. -
missed
boolean missedIndicates a missed update. Guarded by this. -
CANCELLED
static final long CANCELLEDIndicates this child has been cancelled: the state is swapped in atomically and will prevent the dispatch() to emit (too many) values to a terminated child subscriber.- See Also:
-
-
Constructor Details
-
InnerSubscription
InnerSubscription(FlowableReplay.ReplaySubscriber<T> parent, org.reactivestreams.Subscriber<? super T> child)
-
-
Method Details
-
request
public void request(long n) - Specified by:
request
in interfaceorg.reactivestreams.Subscription
-
produced
public long produced(long n) Indicate that values have been emitted to this child subscriber by the dispatch() method.- Parameters:
n
- the number of items emitted- Returns:
- the updated request value (may indicate how much can be produced or a terminal state)
-
isDisposed
public boolean isDisposed()Description copied from interface:Disposable
Returns true if this resource has been disposed.- Specified by:
isDisposed
in interfaceDisposable
- Returns:
- true if this resource has been disposed
-
cancel
public void cancel()- Specified by:
cancel
in interfaceorg.reactivestreams.Subscription
-
dispose
public void dispose()Description copied from interface:Disposable
Dispose the resource, the operation should be idempotent.- Specified by:
dispose
in interfaceDisposable
-
index
<U> U index()Convenience method to auto-cast the index object.- Type Parameters:
U
- type to cast index object- Returns:
- the current index object
-