public class DrainUtils extends Object
Modifier and Type | Field and Description |
---|---|
protected static long |
COMPLETED_MASK
Indicates the source completed and the value field is ready to be emitted.
|
protected static long |
REQUESTED_MASK |
Modifier and Type | Method and Description |
---|---|
static <T> void |
postComplete(org.reactivestreams.Subscriber<? super T> downstream,
Queue<T> queue,
AtomicLong requested,
BooleanSupplier isCancelled)
Tries draining the queue if the source just completed.
|
static <T> boolean |
postCompleteRequest(long n,
org.reactivestreams.Subscriber<? super T> downstream,
Queue<T> queue,
AtomicLong requested,
BooleanSupplier isCancelled)
Perform a potential post-completion request accounting.
|
protected static final long COMPLETED_MASK
The AtomicLong (this) holds the requested amount in bits 0..62 so there is room for one signal bit. This also means the standard request accounting helper method doesn't work.
protected static final long REQUESTED_MASK
public static <T> boolean postCompleteRequest(long n, org.reactivestreams.Subscriber<? super T> downstream, Queue<T> queue, AtomicLong requested, BooleanSupplier isCancelled)
T
- the output value typen
- the requested amountdownstream
- the downstream consumerqueue
- the queue holding the available valuesrequested
- the requested atomic longisCancelled
- callback to detect cancellationpublic static <T> void postComplete(org.reactivestreams.Subscriber<? super T> downstream, Queue<T> queue, AtomicLong requested, BooleanSupplier isCancelled)
T
- the output value typedownstream
- the downstream consumerqueue
- the queue holding available valuesrequested
- the atomic long keeping track of requestsisCancelled
- callback to detect cancellationCopyright © 2019–2020 SmallRye. All rights reserved.