Class Transaction.RetryException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
dev.getelements.elements.sdk.dao.Transaction.RetryException
All Implemented Interfaces:
Serializable
Enclosing interface:
Transaction

public static class Transaction.RetryException extends RuntimeException
Indicates that a transaction failed due to a transient condition and can be retried safely. Some implementations of Transaction use snapshot isolation, which may require client code to implement retry semantics. When Transaction.commit() throws this exception, the caller should restart and re-execute the entire transaction from the beginning. This exception contains a recommended delay in milliseconds before retrying the transaction,
See Also:
  • Field Details

  • Constructor Details

    • RetryException

      public RetryException()
      Default constructor with a default recommended delay of 15 milliseconds.
    • RetryException

      public RetryException(long recommendDelay)
      Constructor with a specified recommended delay in milliseconds.
      Parameters:
      recommendDelay - the recommended delay in milliseconds before retrying the transaction
  • Method Details

    • getRecommendDelay

      public long getRecommendDelay()
      Gets the recommended delay in milliseconds before retrying the transaction.
      Returns:
      the recommended delay in milliseconds
    • waitForRecommendedDelay

      public void waitForRecommendedDelay()
      Waits for the recommended delay before retrying the transaction.