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 longIndicates 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) booleanIndicates an emission state.(package private) ObjectHolds an object that represents the current location in the buffer.(package private) booleanIndicates 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 AtomicLongKeeps the sum of all requested amounts. -
Constructor Summary
ConstructorsConstructorDescriptionInnerSubscription(FlowableReplay.ReplaySubscriber<T> parent, org.reactivestreams.Subscriber<? super T> child) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()voiddispose()Dispose the resource, the operation should be idempotent.(package private) <U> Uindex()Convenience method to auto-cast the index object.booleanReturns true if this resource has been disposed.longproduced(long n) Indicate that values have been emitted to this child subscriber by the dispatch() method.voidrequest(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, weakCompareAndSetVolatileMethods 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:
requestin 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:DisposableReturns true if this resource has been disposed.- Specified by:
isDisposedin interfaceDisposable- Returns:
- true if this resource has been disposed
-
cancel
public void cancel()- Specified by:
cancelin interfaceorg.reactivestreams.Subscription
-
dispose
public void dispose()Description copied from interface:DisposableDispose the resource, the operation should be idempotent.- Specified by:
disposein 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
-