java.lang.Object
org.tentackle.pdo.DefaultTransactionRetryPolicy
- All Implemented Interfaces:
TransactionRetryPolicy
@TransactionRetryPolicyService("")
public class DefaultTransactionRetryPolicy
extends Object
implements TransactionRetryPolicy
The default transaction retry policy.
Retries 7 times after random values around 0.5, 1.0, 2.0, 4.0, 8.0, 16.0 and 32.0 seconds.
Should be enough in most cases.
Application can easily replace this default policy by providing their own implementation
annotated with @TransactionRetryPolicyService("")
.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
waitMillis
(String txName, int count) Computes the number of milliseconds to wait before retrying the transaction.
-
Constructor Details
-
DefaultTransactionRetryPolicy
public DefaultTransactionRetryPolicy()Creates the retry policy.
-
-
Method Details
-
waitMillis
Description copied from interface:TransactionRetryPolicy
Computes the number of milliseconds to wait before retrying the transaction.- Specified by:
waitMillis
in interfaceTransactionRetryPolicy
- Parameters:
txName
- the transaction name, never nullcount
- the number of invocations so far, starting at 1- Returns:
- the number of milliseconds to wait, 0 to fail
-