Interface RetryPolicy
- 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 TypeMethodDescriptionlonggetDelayMillis(int attempt) Returns the delay in milliseconds before the next retry attempt.booleanDetermines whether a failed download should be retried based on the exception.intReturns the maximum number of retry attempts.
-
Method Details
-
isRetryable
Determines whether a failed download should be retried based on the exception.- Parameters:
e- the exception thrown during the download attempt- Returns:
trueif the download should be retried,falseotherwise
-
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)
-