Package io.smallrye.mutiny.helpers
Class HalfSerializer
- java.lang.Object
-
- io.smallrye.mutiny.helpers.HalfSerializer
-
public final class HalfSerializer extends java.lang.ObjectMethods to implement half-serialization: a form of serialization whereonNextis guaranteed to be called from a single thread butonErrororonCompletemay be called from any threads.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidonComplete(org.reactivestreams.Subscriber<?> subscriber, java.util.concurrent.atomic.AtomicInteger wip, java.util.concurrent.atomic.AtomicReference<java.lang.Throwable> container)Propagates the completion event or failure events (if a failure is stored in the container).static voidonError(org.reactivestreams.Subscriber<?> subscriber, java.lang.Throwable failure, java.util.concurrent.atomic.AtomicInteger wip, java.util.concurrent.atomic.AtomicReference<java.lang.Throwable> container)Propagates the given failure if the downstream if possible (no work in progress) or accumulate it to the given failure container to be propagated by a concurrentonNextcall.static <T> voidonNext(org.reactivestreams.Subscriber<? super T> subscriber, T item, java.util.concurrent.atomic.AtomicInteger wip, java.util.concurrent.atomic.AtomicReference<java.lang.Throwable> container)Propagates the given item if possible and terminates if there was a completion or failure event happening during the propagation.
-
-
-
Method Detail
-
onNext
public static <T> void onNext(org.reactivestreams.Subscriber<? super T> subscriber, T item, java.util.concurrent.atomic.AtomicInteger wip, java.util.concurrent.atomic.AtomicReference<java.lang.Throwable> container)Propagates the given item if possible and terminates if there was a completion or failure event happening during the propagation. The item is drops is the downstream already got a terminal event.- Type Parameters:
T- the type of the item- Parameters:
subscriber- the downstream subscriberitem- the item to propagate downstreamwip- the serialization work-in-progress countercontainer- the failure container
-
onError
public static void onError(org.reactivestreams.Subscriber<?> subscriber, java.lang.Throwable failure, java.util.concurrent.atomic.AtomicInteger wip, java.util.concurrent.atomic.AtomicReference<java.lang.Throwable> container)Propagates the given failure if the downstream if possible (no work in progress) or accumulate it to the given failure container to be propagated by a concurrentonNextcall.- Parameters:
subscriber- the downstream subscriberfailure- the failure event to propagatewip- the serialization work-in-progress countercontainer- the failure container
-
onComplete
public static void onComplete(org.reactivestreams.Subscriber<?> subscriber, java.util.concurrent.atomic.AtomicInteger wip, java.util.concurrent.atomic.AtomicReference<java.lang.Throwable> container)Propagates the completion event or failure events (if a failure is stored in the container). If the event cannot be dispatched, a concurrentonNextwill.- Parameters:
subscriber- the downstream subscriberwip- the serialization work-in-progress countercontainer- the failure container
-
-