Package org.dellroad.stuff.spring
Class RetryTransactionProvider.RetrySetup<T>
java.lang.Object
org.dellroad.stuff.spring.RetryTransactionProvider.RetrySetup<T>
- Type Parameters:
T
- transaction return type
- Enclosing interface:
- RetryTransactionProvider
Holds the configuration information that is required when applying retry logic.
Instances are immutable.
- See Also:
-
Constructor Summary
ConstructorDescriptionRetrySetup
(String transactionManagerName, String description, Supplier<T> transaction) Constructor that uses the aspect default values for maximum retries, initial delay, and maximum delay.RetrySetup
(String transactionManagerName, String description, Supplier<T> transaction, int maxRetries, long initialDelay, long maximumDelay) Primary constructor.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. -
Method Summary
Modifier and TypeMethodDescriptionGet a description of the transaction for logging purposes.long
Get the initial delay between retry attempts in milliseconds.long
Get the maximum delay between retry attempts in milliseconds.int
Get the maximum number of transaction retry attempts.Get the transaction to perform and possibly retry.Get name of the associated transaction manager, if any.
-
Constructor Details
-
RetrySetup
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 nulldescription
- description oftransaction
for logging purposestransaction
- 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 nulldescription
- description oftransaction
for logging purposestransaction
- the transaction that should be invoked and retried as neededannotation
-@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 nulldescription
- description oftransaction
for logging purposestransaction
- the transaction that should be invoked and retried as neededmaxRetries
- maximum number of transaction retry attempts, or -1 to use the aspect defaultinitialDelay
- initial delay between retry attempts in milliseconds, or -1 to use the aspect defaultmaximumDelay
- maximum delay between retry attempts in milliseconds, or -1 to use the aspect default
-
-
Method Details
-
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
Get a description of the transaction for logging purposes.- Returns:
- transaction description
-
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
-