Package dev.getelements.elements.sdk.dao
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
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor with a default recommended delay of 15 milliseconds.RetryException(long recommendDelay) Constructor with a specified recommended delay in milliseconds. -
Method Summary
Modifier and TypeMethodDescriptionlongGets the recommended delay in milliseconds before retrying the transaction.voidWaits for the recommended delay before retrying the transaction.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
DEFAULT_RECOMMENDED_DELAY
public static final long DEFAULT_RECOMMENDED_DELAY- See Also:
-
-
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.
-