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
,java.io.Serializable
,org.reactivestreams.Subscription
- Enclosing class:
- FlowableReplay<T>
static final class FlowableReplay.InnerSubscription<T> extends java.util.concurrent.atomic.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
Fields Modifier and Type Field Description (package private) static long
CANCELLED
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) org.reactivestreams.Subscriber<? super T>
child
The actual child subscriber.(package private) boolean
emitting
Indicates an emission state.(package private) java.lang.Object
index
Holds an object that represents the current location in the buffer.(package private) boolean
missed
Indicates a missed update.(package private) FlowableReplay.ReplaySubscriber<T>
parent
The parent subscriber-to-source used to allow removing the child in case of child cancellation.private static long
serialVersionUID
(package private) java.util.concurrent.atomic.AtomicLong
totalRequested
Keeps the sum of all requested amounts.
-
Constructor Summary
Constructors Constructor Description InnerSubscription(FlowableReplay.ReplaySubscriber<T> parent, org.reactivestreams.Subscriber<? super T> child)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
isDisposed()
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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
parent
final FlowableReplay.ReplaySubscriber<T> parent
The parent subscriber-to-source used to allow removing the child in case of child cancellation.
-
child
final org.reactivestreams.Subscriber<? super T> child
The actual child subscriber.
-
index
java.lang.Object index
Holds an object that represents the current location in the buffer. Guarded by the emitter loop.
-
totalRequested
final java.util.concurrent.atomic.AtomicLong totalRequested
Keeps the sum of all requested amounts.
-
emitting
boolean emitting
Indicates an emission state. Guarded by this.
-
missed
boolean missed
Indicates a missed update. Guarded by this.
-
CANCELLED
static final long CANCELLED
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.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InnerSubscription
InnerSubscription(FlowableReplay.ReplaySubscriber<T> parent, org.reactivestreams.Subscriber<? super T> child)
-
-
Method Detail
-
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
-
-