java.lang.Object
com.github.mizosoft.methanol.internal.flow.FlowSupport
Helpers for implementing reactive streams subscriptions and the like.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Flow.Subscription
A subscription that does nothing.static final Executor
An executor that executes the runnable in the calling thread. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Flow.Publisher
<T> static long
getAndAddDemand
(Object owner, VarHandle demand, long n) Adds the given count to demand, making sure it doesn't exceedLong.MAX_VALUE
.static IllegalArgumentException
Returns anIllegalArgumentException
to signal if the subscriber requests a non-positive number of items.static void
onDroppedException
(Throwable exception) static int
prefetch()
Returns the prefetch property or a default of 8.static int
Returns the prefetch threshold according to the prefetch factor property or a default of 8/ 2
.static void
rejectMulticast
(Flow.Subscriber<?> subscriber) static long
subtractAndGetDemand
(Object owner, VarHandle demand, long n) Subtracts given count from demand.
-
Field Details
-
NOOP_SUBSCRIPTION
A subscription that does nothing. -
SYNC_EXECUTOR
An executor that executes the runnable in the calling thread.
-
-
Method Details
-
illegalRequest
Returns anIllegalArgumentException
to signal if the subscriber requests a non-positive number of items. -
prefetch
public static int prefetch()Returns the prefetch property or a default of 8. -
prefetchThreshold
public static int prefetchThreshold()Returns the prefetch threshold according to the prefetch factor property or a default of 8/ 2
. -
getAndAddDemand
Adds the given count to demand, making sure it doesn't exceedLong.MAX_VALUE
. -
subtractAndGetDemand
Subtracts given count from demand. Caller must ensure the result won't be negative. -
emptyPublisher
-
rejectMulticast
-
onDroppedException
-