Interface RetryStrategy

  • All Known Implementing Classes:
    ExponentialBackoffStrategy, NoRetryStrategy

    public interface RetryStrategy
    This client comes with an ExponentialRetryStrategy, and it is recommended that users stick with that. If you choose to implement your own RetryStrategy, then it should implement this interface, and be thread-safe (or not store state).
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean canRetry​(int retryAttempt)
      Returns true if the given retry attempt will be allowed by this strategy.
      int getDelayMillis​(int retryAttempt)
      Return the number of milliseconds to delay the next retry attempt.
      int getMaxRetryAttempts()
      Return the maximum number of retry attempts for this strategy.
    • Method Detail

      • canRetry

        boolean canRetry​(int retryAttempt)
        Returns true if the given retry attempt will be allowed by this strategy.
        Parameters:
        retryAttempt - The retry attempt number, starting at 1 (i.e. the second overall attempt, or first retry is attempt 1).
        Returns:
        True if this attempt can be retried, otherwise false.
      • getDelayMillis

        int getDelayMillis​(int retryAttempt)
        Return the number of milliseconds to delay the next retry attempt.
        Parameters:
        retryAttempt - The retry attempt number, starting at 1 (i.e. the second overall attempt/first retry is #1).
        Returns:
        The number of milliseconds to delay the next retry attempt.
      • getMaxRetryAttempts

        int getMaxRetryAttempts()
        Return the maximum number of retry attempts for this strategy.
        Returns:
        The number of retry attempts that this strategy will attempt.