Class DrainUtils
- java.lang.Object
-
- io.smallrye.mutiny.helpers.queues.DrainUtils
-
public class DrainUtils extends java.lang.ObjectCopy from Project Reactor.
-
-
Field Summary
Fields Modifier and Type Field Description protected static longCOMPLETED_MASKIndicates the source completed and the value field is ready to be emitted.protected static longREQUESTED_MASK
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> voidpostComplete(org.reactivestreams.Subscriber<? super T> downstream, java.util.Queue<T> queue, java.util.concurrent.atomic.AtomicLong requested, java.util.function.BooleanSupplier isCancelled)Tries draining the queue if the source just completed.static <T> booleanpostCompleteRequest(long n, org.reactivestreams.Subscriber<? super T> downstream, java.util.Queue<T> queue, java.util.concurrent.atomic.AtomicLong requested, java.util.function.BooleanSupplier isCancelled)Perform a potential post-completion request accounting.
-
-
-
Field Detail
-
COMPLETED_MASK
protected static final long COMPLETED_MASK
Indicates the source completed and the value field is ready to be emitted.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.
- See Also:
- Constant Field Values
-
REQUESTED_MASK
protected static final long REQUESTED_MASK
- See Also:
- Constant Field Values
-
-
Method Detail
-
postCompleteRequest
public static <T> boolean postCompleteRequest(long n, org.reactivestreams.Subscriber<? super T> downstream, java.util.Queue<T> queue, java.util.concurrent.atomic.AtomicLong requested, java.util.function.BooleanSupplier isCancelled)Perform a potential post-completion request accounting.- Type Parameters:
T- the output value type- Parameters:
n- the requested amountdownstream- the downstream consumerqueue- the queue holding the available valuesrequested- the requested atomic longisCancelled- callback to detect cancellation- Returns:
- true if the state indicates a completion state.
-
postComplete
public static <T> void postComplete(org.reactivestreams.Subscriber<? super T> downstream, java.util.Queue<T> queue, java.util.concurrent.atomic.AtomicLong requested, java.util.function.BooleanSupplier isCancelled)Tries draining the queue if the source just completed.- Type Parameters:
T- the output value type- Parameters:
downstream- the downstream consumerqueue- the queue holding available valuesrequested- the atomic long keeping track of requestsisCancelled- callback to detect cancellation
-
-