Interface RetryTransactionProvider


public interface RetryTransactionProvider
Interface implemented by the RetryTransactionAspect, which implements the RetryTransaction functionality.
See Also:
  • Method Details

    • getPersistenceExceptionTranslator

      PersistenceExceptionTranslator getPersistenceExceptionTranslator()
      Get the configured exception translator.
      Returns:
      exception translator used to determine which transactions are retryable
    • setPersistenceExceptionTranslator

      void setPersistenceExceptionTranslator(PersistenceExceptionTranslator persistenceExceptionTranslator)
      Set the configured exception translator.
      Parameters:
      persistenceExceptionTranslator - exception translator used to determine which transactions are retryable
    • getMaxRetriesDefault

      int getMaxRetriesDefault()
      Get the aspect-wide default for RetryTransaction.maxRetries().
      Returns:
      default maximum number of transaction retry attempts
    • setMaxRetriesDefault

      void setMaxRetriesDefault(int maxRetriesDefault)
      Set the aspect-wide default for RetryTransaction.maxRetries().
      Parameters:
      maxRetriesDefault - default maximum number of transaction retry attempts
    • getInitialDelayDefault

      long getInitialDelayDefault()
      Get the aspect-wide default for RetryTransaction.initialDelay().
      Returns:
      default initial delay between retry attempts in milliseconds
    • setInitialDelayDefault

      void setInitialDelayDefault(long initialDelayDefault)
      Set the aspect-wide default for RetryTransaction.initialDelay().
      Parameters:
      initialDelayDefault - default initial delay between retry attempts in milliseconds
    • getMaximumDelayDefault

      long getMaximumDelayDefault()
      Get the aspect-wide default for RetryTransaction.maximumDelay().
      Returns:
      default maximum delay between retry attempts in milliseconds
    • setMaximumDelayDefault

      void setMaximumDelayDefault(long maximumDelayDefault)
      Set the aspect-wide default for RetryTransaction.maximumDelay().
      Parameters:
      maximumDelayDefault - default maximum delay between retry attempts in milliseconds
    • getAttemptNumber

      int getAttemptNumber()
      Get the current transaction attempt number in the inner-most active transaction.

      Equivalent to getAttemptNumber(null).

      Returns:
      transaction attempt number, or zero if the aspect is not active in the current thread
    • getAttemptNumber

      int getAttemptNumber(String transactionManagerName)
      Get the current transaction attempt number for the specified transaction manager.
      Parameters:
      transactionManagerName - transaction manager name, or null to match all
      Returns:
      transaction attempt number, or zero if the aspect is not active in the current thread for the transaction manager
    • retry

      <T> T retry(RetryTransactionProvider.RetrySetup<T> setup)
      Perform a transaction, retrying as necessary.

      This method provides a way to apply retry logic directly without going through a method woven with the aspect.

      Type Parameters:
      T - transaction return type
      Parameters:
      setup - retryable transaction setup
      Returns:
      result from transaction
      Throws:
      IllegalArgumentException - if setup is null