Class RetryTransactionProvider.RetrySetup<T>

java.lang.Object
org.dellroad.stuff.spring.RetryTransactionProvider.RetrySetup<T>
Type Parameters:
T - transaction return type
Enclosing interface:
RetryTransactionProvider

public static class RetryTransactionProvider.RetrySetup<T> extends Object
Holds the configuration information that is required when applying retry logic.

Instances are immutable.

See Also:
  • Constructor Details

    • RetrySetup

      public RetrySetup(String transactionManagerName, String description, Supplier<T> transaction)
      Constructor that uses the aspect default values for maximum retries, initial delay, and maximum delay.
      Parameters:
      transactionManagerName - the name of the associated transaction manager, if any, otherwise null
      description - description of transaction for logging purposes
      transaction - the transaction that should be invoked and retried as needed
    • RetrySetup

      public RetrySetup(String transactionManagerName, String description, Supplier<T> transaction, RetryTransaction annotation)
      Constructor that uses the values from a @RetryTransaction annotation, if not null, for maximum retries, initial delay, and maximum delay, otherwise falling back to the aspect defaults.
      Parameters:
      transactionManagerName - the name of the associated transaction manager, if any, otherwise null
      description - description of transaction for logging purposes
      transaction - the transaction that should be invoked and retried as needed
      annotation - @RetryTransaction annotation, or null to use aspect defaults
    • RetrySetup

      public RetrySetup(String transactionManagerName, String description, Supplier<T> transaction, int maxRetries, long initialDelay, long maximumDelay)
      Primary constructor.
      Parameters:
      transactionManagerName - the name of the associated transaction manager, if any, otherwise null
      description - description of transaction for logging purposes
      transaction - the transaction that should be invoked and retried as needed
      maxRetries - maximum number of transaction retry attempts, or -1 to use the aspect default
      initialDelay - initial delay between retry attempts in milliseconds, or -1 to use the aspect default
      maximumDelay - maximum delay between retry attempts in milliseconds, or -1 to use the aspect default
  • Method Details

    • getTransactionManagerName

      public String getTransactionManagerName()
      Get name of the associated transaction manager, if any.

      This value is used by the woven aspect to avoid redundant nested retries within an already-open transaction.

      Returns:
      transaction manager name, or null to be invisible to redundancy checks
    • getDescription

      public String getDescription()
      Get a description of the transaction for logging purposes.
      Returns:
      transaction description
    • getTransaction

      public Supplier<T> getTransaction()
      Get the transaction to perform and possibly retry.
      Returns:
      transaction
    • getMaxRetries

      public int getMaxRetries()
      Get the maximum number of transaction retry attempts.
      Returns:
      maximum number of retries, or -1 to use the aspect default
    • getInitialDelay

      public long getInitialDelay()
      Get the initial delay between retry attempts in milliseconds.
      Returns:
      initial delay between retry attempts, or -1 to use the aspect default
    • getMaximumDelay

      public long getMaximumDelay()
      Get the maximum delay between retry attempts in milliseconds.
      Returns:
      maximum delay between retry attempts, or -1 to use the aspect default