Class AtomicThrowable

java.lang.Object
java.util.concurrent.atomic.AtomicReference<Throwable>
com.forgerock.rxjava3.intern.util.AtomicThrowable
All Implemented Interfaces:
Serializable

public final class AtomicThrowable extends AtomicReference<Throwable>
Atomic container for Throwables including combining and having a terminal state via ExceptionHelper.

Watch out for the leaked AtomicReference methods!

See Also:
  • Constructor Details

    • AtomicThrowable

      public AtomicThrowable()
  • Method Details

    • tryAddThrowable

      public boolean tryAddThrowable(Throwable t)
      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

      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 - the throwable to add
      Returns:
      true if successful, false if the container has been terminated
    • terminate

      public Throwable 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