All Known Implementing Classes:
ExponentialBackoffRetryPolicy

public interface RetryPolicy
Abstraction for retry behavior during resource downloads. Implementations determine which exceptions are retryable and how long to wait between attempts.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    getDelayMillis(int attempt)
    Returns the delay in milliseconds before the next retry attempt.
    boolean
    Determines whether a failed download should be retried based on the exception.
    int
    Returns the maximum number of retry attempts.
  • Method Details

    • isRetryable

      boolean isRetryable(Exception e)
      Determines whether a failed download should be retried based on the exception.
      Parameters:
      e - the exception thrown during the download attempt
      Returns:
      true if the download should be retried, false otherwise
    • getDelayMillis

      long getDelayMillis(int attempt)
      Returns the delay in milliseconds before the next retry attempt.
      Parameters:
      attempt - the current attempt number (1-based, so 1 means the delay before the first retry)
      Returns:
      the delay in milliseconds
    • maxRetries

      int maxRetries()
      Returns the maximum number of retry attempts.
      Returns:
      the maximum number of retries (0 means no retries)