- java.lang.Object
-
- com.github.mizosoft.methanol.internal.flow.FlowSupport
-
public class FlowSupport extends java.lang.ObjectHelpers for implementing reactive streams subscriptions and the like.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.concurrent.Flow.SubscriptionNOOP_SUBSCRIPTIONA subscription that does nothing.static java.util.concurrent.ExecutorSYNC_EXECUTORAn executor that executes the runnable in the calling thread.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> java.util.concurrent.Flow.Publisher<T>emptyPublisher()static longgetAndAddDemand(java.lang.Object owner, java.lang.invoke.VarHandle demand, long n)Adds the given count to demand, making sure it doesn't exceedLong.MAX_VALUE.static voidonDroppedException(java.lang.Throwable exception)static intprefetch()Returns the prefetch property or a default of 8.static intprefetchThreshold()Returns the prefetch threshold according to the prefetch factor property or a default of 8/ 2.static voidreject(java.util.concurrent.Flow.Subscriber<?> subscriber, java.lang.Throwable cause)static voidrejectMulticast(java.util.concurrent.Flow.Subscriber<?> subscriber)static longsubtractAndGetDemand(java.lang.Object owner, java.lang.invoke.VarHandle demand, long n)Subtracts given count from demand.
-
-
-
Method Detail
-
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
public static long getAndAddDemand(java.lang.Object owner, java.lang.invoke.VarHandle demand, long n)Adds the given count to demand, making sure it doesn't exceedLong.MAX_VALUE.
-
subtractAndGetDemand
public static long subtractAndGetDemand(java.lang.Object owner, java.lang.invoke.VarHandle demand, long n)Subtracts given count from demand. Caller must ensure the result won't be negative.
-
emptyPublisher
public static <T> java.util.concurrent.Flow.Publisher<T> emptyPublisher()
-
rejectMulticast
public static void rejectMulticast(java.util.concurrent.Flow.Subscriber<?> subscriber)
-
reject
public static void reject(java.util.concurrent.Flow.Subscriber<?> subscriber, java.lang.Throwable cause)
-
onDroppedException
public static void onDroppedException(java.lang.Throwable exception)
-
-