Class HalfSerializer
- java.lang.Object
-
- io.reactivex.rxjava3.internal.util.HalfSerializer
-
public final class HalfSerializer extends java.lang.ObjectUtility methods to perform half-serialization: a form of serialization where onNext is guaranteed to be called from a single thread but onError or onComplete may be called from any threads.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateHalfSerializer()Utility class.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidonComplete(Observer<?> observer, java.util.concurrent.atomic.AtomicInteger wip, AtomicThrowable errors)Emits an onComplete signal or an onError signal with the given error or indicates the concurrently running onNext should do that.static voidonComplete(org.reactivestreams.Subscriber<?> subscriber, java.util.concurrent.atomic.AtomicInteger wip, AtomicThrowable errors)Emits an onComplete signal or an onError signal with the given error or indicates the concurrently running onNext should do that.static voidonError(Observer<?> observer, java.lang.Throwable ex, java.util.concurrent.atomic.AtomicInteger wip, AtomicThrowable errors)Emits the given exception if possible or adds it to the given error container to be emitted by a concurrent onNext if one is running.static voidonError(org.reactivestreams.Subscriber<?> subscriber, java.lang.Throwable ex, java.util.concurrent.atomic.AtomicInteger wip, AtomicThrowable errors)Emits the given exception if possible or adds it to the given error container to be emitted by a concurrent onNext if one is running.static <T> voidonNext(Observer<? super T> observer, T value, java.util.concurrent.atomic.AtomicInteger wip, AtomicThrowable errors)Emits the given value if possible and terminates if there was an onComplete or onError while emitting, drops the value otherwise.static <T> booleanonNext(org.reactivestreams.Subscriber<? super T> subscriber, T value, java.util.concurrent.atomic.AtomicInteger wip, AtomicThrowable errors)Emits the given value if possible and terminates if there was an onComplete or onError while emitting, drops the value otherwise.
-
-
-
Method Detail
-
onNext
public static <T> boolean onNext(org.reactivestreams.Subscriber<? super T> subscriber, T value, java.util.concurrent.atomic.AtomicInteger wip, AtomicThrowable errors)Emits the given value if possible and terminates if there was an onComplete or onError while emitting, drops the value otherwise.- Type Parameters:
T- the value type- Parameters:
subscriber- the target Subscriber to emit tovalue- the value to emitwip- the serialization work-in-progress counter/indicatorerrors- the holder of Throwables- Returns:
- true if the operation succeeded, false if there sequence completed
-
onError
public static void onError(org.reactivestreams.Subscriber<?> subscriber, java.lang.Throwable ex, java.util.concurrent.atomic.AtomicInteger wip, AtomicThrowable errors)Emits the given exception if possible or adds it to the given error container to be emitted by a concurrent onNext if one is running. Undeliverable exceptions are sent to the RxJavaPlugins.onError.- Parameters:
subscriber- the target Subscriber to emit toex- the Throwable to emitwip- the serialization work-in-progress counter/indicatorerrors- the holder of Throwables
-
onComplete
public static void onComplete(org.reactivestreams.Subscriber<?> subscriber, java.util.concurrent.atomic.AtomicInteger wip, AtomicThrowable errors)Emits an onComplete signal or an onError signal with the given error or indicates the concurrently running onNext should do that.- Parameters:
subscriber- the target Subscriber to emit towip- the serialization work-in-progress counter/indicatorerrors- the holder of Throwables
-
onNext
public static <T> void onNext(Observer<? super T> observer, T value, java.util.concurrent.atomic.AtomicInteger wip, AtomicThrowable errors)
Emits the given value if possible and terminates if there was an onComplete or onError while emitting, drops the value otherwise.- Type Parameters:
T- the value type- Parameters:
observer- the target Observer to emit tovalue- the value to emitwip- the serialization work-in-progress counter/indicatorerrors- the holder of Throwables
-
onError
public static void onError(Observer<?> observer, java.lang.Throwable ex, java.util.concurrent.atomic.AtomicInteger wip, AtomicThrowable errors)
Emits the given exception if possible or adds it to the given error container to be emitted by a concurrent onNext if one is running. Undeliverable exceptions are sent to the RxJavaPlugins.onError.- Parameters:
observer- the target Subscriber to emit toex- the Throwable to emitwip- the serialization work-in-progress counter/indicatorerrors- the holder of Throwables
-
onComplete
public static void onComplete(Observer<?> observer, java.util.concurrent.atomic.AtomicInteger wip, AtomicThrowable errors)
Emits an onComplete signal or an onError signal with the given error or indicates the concurrently running onNext should do that.- Parameters:
observer- the target Subscriber to emit towip- the serialization work-in-progress counter/indicatorerrors- the holder of Throwables
-
-