Class AtomicThrowable
java.lang.Object
java.util.concurrent.atomic.AtomicReference<Throwable>
com.forgerock.rxjava3.intern.util.AtomicThrowable
- All Implemented Interfaces:
Serializable
Atomic container for Throwables including combining and having a terminal state via ExceptionHelper.
Watch out for the leaked AtomicReference methods!
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAtomically terminate the container and return the contents of the last non-terminal Throwable of it.boolean
Atomically adds a Throwable to this container (combining with a previous Throwable is necessary).boolean
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.void
tryTerminateConsumer
(org.reactivestreams.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).Methods inherited from class java.util.concurrent.atomic.AtomicReference
accumulateAndGet, compareAndExchange, compareAndExchangeAcquire, compareAndExchangeRelease, compareAndSet, get, getAcquire, getAndAccumulate, getAndSet, getAndUpdate, getOpaque, getPlain, lazySet, set, setOpaque, setPlain, setRelease, toString, updateAndGet, weakCompareAndSet, weakCompareAndSetAcquire, weakCompareAndSetPlain, weakCompareAndSetRelease, weakCompareAndSetVolatile
-
Constructor Details
-
AtomicThrowable
public AtomicThrowable()
-
-
Method Details
-
tryAddThrowable
Atomically adds a Throwable to this container (combining with a previous Throwable is necessary).- Parameters:
t
- the throwable to add- Returns:
- true if successful, false if the container has been terminated
-
tryAddThrowableOrReport
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
- the throwable to add- Returns:
- true if successful, false if the container has been terminated
-
terminate
Atomically terminate the container and return the contents of the last non-terminal Throwable of it.- Returns:
- the last Throwable
-
tryTerminateConsumer
public void tryTerminateConsumer(org.reactivestreams.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
- the consumer to notify
-