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 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 attempt.
        Parameters:
        retryAttempt - The retry attempt number, starting at 1 (i.e. the second overall attempt, or first retry is attempt 1).
        Returns:
      • getMaxRetryAttempts

        int getMaxRetryAttempts()