Enum Class ExceptionsUtils

java.lang.Object
java.lang.Enum<ExceptionsUtils>
rx.internal.util.ExceptionsUtils
All Implemented Interfaces:
Serializable, Comparable<ExceptionsUtils>, Constable

public enum ExceptionsUtils extends Enum<ExceptionsUtils>
Utility methods for terminal atomics with Throwables.
Since:
1.1.2
  • Field Details

    • TERMINATED

      private static final Throwable TERMINATED
      The single instance of a Throwable indicating a terminal state.
  • Constructor Details

    • ExceptionsUtils

      private ExceptionsUtils()
  • Method Details

    • values

      public static ExceptionsUtils[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ExceptionsUtils valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • addThrowable

      public static boolean addThrowable(AtomicReference<Throwable> field, Throwable error)
      Atomically sets or combines the error with the contents of the field, wrapping multiple errors into CompositeException if necessary.
      Parameters:
      field - the target field
      error - the error to add
      Returns:
      true if successful, false if the target field contains the terminal Throwable.
    • terminate

      public static Throwable terminate(AtomicReference<Throwable> field)
      Atomically swaps in the terminal Throwable and returns the previous contents of the field
      Parameters:
      field - the target field
      Returns:
      the previous contents of the field before the swap, may be null
    • isTerminated

      public static boolean isTerminated(AtomicReference<Throwable> field)
      Checks if the given field holds the terminated Throwable instance.
      Parameters:
      field - the target field
      Returns:
      true if the given field holds the terminated Throwable instance
    • isTerminated

      public static boolean isTerminated(Throwable error)
      Returns true if the value is the terminated Throwable instance.
      Parameters:
      error - the error to check
      Returns:
      true if the value is the terminated Throwable instance