Top Description Constructors Methods
io.reactivex.rxjava3.internal.util

public final Class HalfSerializer

extends Object
Class Inheritance
Imports
java.util.concurrent.atomic.AtomicInteger, org.reactivestreams.Subscriber, io.reactivex.rxjava3.core.Observer

Utility 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

AccessConstructor and Description
private
HalfSerializer()

Utility class.

Method Summary

Modifier and TypeMethod and Description
public static void
onComplete(Subscriber<?>
the target Subscriber to emit to
subscriber
,
AtomicInteger
the serialization work-in-progress counter/indicator
wip
,
AtomicThrowable
the holder of Throwables
errors
)

Emits an onComplete signal or an onError signal with the given error or indicates the concurrently running onNext should do that.

public static void
onComplete(Observer<?>
the target Subscriber to emit to
observer
,
AtomicInteger
the serialization work-in-progress counter/indicator
wip
,
AtomicThrowable
the holder of Throwables
errors
)

Emits an onComplete signal or an onError signal with the given error or indicates the concurrently running onNext should do that.

public static void
onError(Subscriber<?>
the target Subscriber to emit to
subscriber
,
Throwable
the Throwable to emit
ex
,
AtomicInteger
the serialization work-in-progress counter/indicator
wip
,
AtomicThrowable
the holder of Throwables
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.

public static void
onError(Observer<?>
the target Subscriber to emit to
observer
,
Throwable
the Throwable to emit
ex
,
AtomicInteger
the serialization work-in-progress counter/indicator
wip
,
AtomicThrowable
the holder of Throwables
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.

public static <
the value type
T
>
boolean

Returns:

true if the operation succeeded, false if there sequence completed
onNext
(Subscriber<? super T>
the target Subscriber to emit to
subscriber
,
T
the value to emit
value
,
AtomicInteger
the serialization work-in-progress counter/indicator
wip
,
AtomicThrowable
the holder of Throwables
errors
)

Emits the given value if possible and terminates if there was an onComplete or onError while emitting, drops the value otherwise.

public static <
the value type
T
>
void
onNext(Observer<? super T>
the target Observer to emit to
observer
,
T
the value to emit
value
,
AtomicInteger
the serialization work-in-progress counter/indicator
wip
,
AtomicThrowable
the holder of Throwables
errors
)

Emits the given value if possible and terminates if there was an onComplete or onError while emitting, drops the value otherwise.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

HalfSerializerback to summary
private HalfSerializer()

Utility class.

Method Detail

onCompleteback to summary
public static void onComplete(Subscriber<?> subscriber, 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:Subscriber<?>

the target Subscriber to emit to

wip:AtomicInteger

the serialization work-in-progress counter/indicator

errors:AtomicThrowable

the holder of Throwables

onCompleteback to summary
public static void onComplete(Observer<?> observer, 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:Observer<?>

the target Subscriber to emit to

wip:AtomicInteger

the serialization work-in-progress counter/indicator

errors:AtomicThrowable

the holder of Throwables

onErrorback to summary
public static void onError(Subscriber<?> subscriber, Throwable ex, 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:Subscriber<?>

the target Subscriber to emit to

ex:Throwable

the Throwable to emit

wip:AtomicInteger

the serialization work-in-progress counter/indicator

errors:AtomicThrowable

the holder of Throwables

onErrorback to summary
public static void onError(Observer<?> observer, Throwable ex, 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:Observer<?>

the target Subscriber to emit to

ex:Throwable

the Throwable to emit

wip:AtomicInteger

the serialization work-in-progress counter/indicator

errors:AtomicThrowable

the holder of Throwables

onNextback to summary
public static <T> boolean onNext(Subscriber<? super T> subscriber, T value, 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.

Parameters
<T>
the value type
subscriber:Subscriber<? super T>

the target Subscriber to emit to

value:T

the value to emit

wip:AtomicInteger

the serialization work-in-progress counter/indicator

errors:AtomicThrowable

the holder of Throwables

Returns:boolean

true if the operation succeeded, false if there sequence completed

onNextback to summary
public static <T> void onNext(Observer<? super T> observer, T value, 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.

Parameters
<T>
the value type
observer:Observer<? super T>

the target Observer to emit to

value:T

the value to emit

wip:AtomicInteger

the serialization work-in-progress counter/indicator

errors:AtomicThrowable

the holder of Throwables