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

public final Class AtomicThrowable

extends AtomicReference<Throwable>
Class Inheritance
Imports
java.util.concurrent.atomic.AtomicReference, org.reactivestreams.Subscriber, io.reactivex.rxjava3.core.*, io.reactivex.rxjava3.plugins.RxJavaPlugins

Atomic container for Throwables including combining and having a terminal state via ExceptionHelper.

Watch out for the leaked AtomicReference methods!

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
public Throwable

Returns:

the last Throwable
terminate
()

Atomically terminate the container and return the contents of the last non-terminal Throwable of it.

public boolean

Returns:

true if successful, false if the container has been terminated
tryAddThrowable
(Throwable
the throwable to add
t
)

Atomically adds a Throwable to this container (combining with a previous Throwable is necessary).

public boolean

Returns:

true if successful, false if the container has been terminated
tryAddThrowableOrReport
(Throwable
the throwable to add
t
)

Atomically adds a Throwable to this container (combining with a previous Throwable is necessary) or reports the error the global error handler and no changes are made.

public void
tryTerminateAndReport()

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and calls RxJavaPlugins#onError(Throwable) if there was a non-null, non-indicator exception contained within before.

public void
tryTerminateConsumer(Subscriber<?>
the consumer to notify
consumer
)

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and notifies the consumer if there was no error (onComplete) or there was a non-null, non-indicator exception contained before (onError).

public void
tryTerminateConsumer(Observer<?>
the consumer to notify
consumer
)

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and notifies the consumer if there was no error (onComplete) or there was a non-null, non-indicator exception contained before (onError).

public void
tryTerminateConsumer(MaybeObserver<?>
the consumer to notify
consumer
)

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and notifies the consumer if there was no error (onComplete) or there was a non-null, non-indicator exception contained before (onError).

public void
tryTerminateConsumer(SingleObserver<?>
the consumer to notify
consumer
)

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and notifies the consumer if there was no error (onComplete) or there was a non-null, non-indicator exception contained before (onError).

public void
tryTerminateConsumer(CompletableObserver
the consumer to notify
consumer
)

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and notifies the consumer if there was no error (onComplete) or there was a non-null, non-indicator exception contained before (onError).

public void
tryTerminateConsumer(Emitter<?>
the consumer to notify
consumer
)

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and notifies the consumer if there was no error (onComplete) or there was a non-null, non-indicator exception contained before (onError).

Inherited from java.util.concurrent.atomic.AtomicReference:
accumulateAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndAccumulategetAndSetgetAndUpdategetOpaquegetPlainlazySetsetsetOpaquesetPlainsetReleasetoStringupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicReference.serialVersionUID.

Constructor Detail

AtomicThrowableback to summary
public AtomicThrowable()

Method Detail

isTerminatedback to summary
public boolean isTerminated()
terminateback to summary
public Throwable terminate()

Atomically terminate the container and return the contents of the last non-terminal Throwable of it.

Returns:Throwable

the last Throwable

tryAddThrowableback to summary
public boolean tryAddThrowable(Throwable t)

Atomically adds a Throwable to this container (combining with a previous Throwable is necessary).

Parameters
t:Throwable

the throwable to add

Returns:boolean

true if successful, false if the container has been terminated

tryAddThrowableOrReportback to summary
public boolean tryAddThrowableOrReport(Throwable t)

Atomically adds a Throwable to this container (combining with a previous Throwable is necessary) or reports the error the global error handler and no changes are made.

Parameters
t:Throwable

the throwable to add

Returns:boolean

true if successful, false if the container has been terminated

tryTerminateAndReportback to summary
public void tryTerminateAndReport()

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and calls RxJavaPlugins#onError(Throwable) if there was a non-null, non-indicator exception contained within before.

Since
3.0.0
tryTerminateConsumerback to summary
public void tryTerminateConsumer(Subscriber<?> consumer)

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and notifies the consumer if there was no error (onComplete) or there was a non-null, non-indicator exception contained before (onError). If there was a terminated indicator, the consumer is not signaled.

Parameters
consumer:Subscriber<?>

the consumer to notify

tryTerminateConsumerback to summary
public void tryTerminateConsumer(Observer<?> consumer)

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and notifies the consumer if there was no error (onComplete) or there was a non-null, non-indicator exception contained before (onError). If there was a terminated indicator, the consumer is not signaled.

Parameters
consumer:Observer<?>

the consumer to notify

tryTerminateConsumerback to summary
public void tryTerminateConsumer(MaybeObserver<?> consumer)

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and notifies the consumer if there was no error (onComplete) or there was a non-null, non-indicator exception contained before (onError). If there was a terminated indicator, the consumer is not signaled.

Parameters
consumer:MaybeObserver<?>

the consumer to notify

tryTerminateConsumerback to summary
public void tryTerminateConsumer(SingleObserver<?> consumer)

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and notifies the consumer if there was no error (onComplete) or there was a non-null, non-indicator exception contained before (onError). If there was a terminated indicator, the consumer is not signaled.

Parameters
consumer:SingleObserver<?>

the consumer to notify

tryTerminateConsumerback to summary
public void tryTerminateConsumer(CompletableObserver consumer)

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and notifies the consumer if there was no error (onComplete) or there was a non-null, non-indicator exception contained before (onError). If there was a terminated indicator, the consumer is not signaled.

Parameters
consumer:CompletableObserver

the consumer to notify

tryTerminateConsumerback to summary
public void tryTerminateConsumer(Emitter<?> consumer)

Tries to terminate this atomic throwable (by swapping in the TERMINATED indicator) and notifies the consumer if there was no error (onComplete) or there was a non-null, non-indicator exception contained before (onError). If there was a terminated indicator, the consumer is not signaled.

Parameters
consumer:Emitter<?>

the consumer to notify