Class ThrowableConstants

java.lang.Object
com.sun.jini.constants.ThrowableConstants

public class ThrowableConstants extends Object
Various constants useful in processing exceptions
Author:
Sun Microsystems, Inc.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Value returned by retryable to indicate that the passed Throwable implies that retrying the operation that threw the Throwable with the same arguments and the same expected return value would not be fruitful.
    static final int
    Value returned by retryable to indicate that the passed Throwable implies that any further operations on the object that threw the Throwable would not be fruitful.
    static final int
    Value returned by retryable to indicate that the passed Throwable does not provide any new information on the state of the object that threw it.
    static final int
    Value returned by retryable to indicate that the passed Throwable was of a type that could not be classified.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    Attempt to classify the passed Throwable in terms of what it implies about the probability of success of future operations on the object that threw the exception.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INDEFINITE

      public static final int INDEFINITE
      Value returned by retryable to indicate that the passed Throwable does not provide any new information on the state of the object that threw it.
      See Also:
    • BAD_INVOCATION

      public static final int BAD_INVOCATION
      Value returned by retryable to indicate that the passed Throwable implies that retrying the operation that threw the Throwable with the same arguments and the same expected return value would not be fruitful.
      See Also:
    • BAD_OBJECT

      public static final int BAD_OBJECT
      Value returned by retryable to indicate that the passed Throwable implies that any further operations on the object that threw the Throwable would not be fruitful.
      See Also:
    • UNCATEGORIZED

      public static final int UNCATEGORIZED
      Value returned by retryable to indicate that the passed Throwable was of a type that could not be classified.
      See Also:
  • Constructor Details

    • ThrowableConstants

      public ThrowableConstants()
  • Method Details

    • retryable

      public static int retryable(Throwable t)
      Attempt to classify the passed Throwable in terms of what it implies about the probability of success of future operations on the object that threw the exception.

      Note, the classification used by this method tends to assume the worst. For exceptions that represent conditions that could get better by themselves but probably will not, it will return BAD_OBJECT or BAD_INVOCATION instead of INDEFINITE. This makes it suitable for situations where it is better to give up, fail early, and notify the next layer up that something is wrong than to continue silently and retry. It is probably not a good choice for situations where the stakes are higher, like deciding when to give up on a prepared transaction.

      Returns:
      INDEFINITE, BAD_INVOCATION, or BAD_OBJECT if the exception is a RuntimeException, Error, or java.rmi.RemoteException depending on the details of the Throwable. Otherwise return UNCATEGORIZED
      Throws:
      NullPointerException - if the passed Throwable is null