Class DefaultTransactionRetryPolicy

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 Details

    • DefaultTransactionRetryPolicy

      public DefaultTransactionRetryPolicy()
      Creates the retry policy.
  • Method Details

    • waitMillis

      public long waitMillis(String txName, int count)
      Description copied from interface: TransactionRetryPolicy
      Computes the number of milliseconds to wait before retrying the transaction.
      Specified by:
      waitMillis in interface TransactionRetryPolicy
      Parameters:
      txName - the transaction name, never null
      count - the number of invocations so far, starting at 1
      Returns:
      the number of milliseconds to wait, 0 to fail