Class ExponentialBackoffRetryPolicy
java.lang.Object
ai.wanaku.capabilities.sdk.runtime.camel.downloader.ExponentialBackoffRetryPolicy
- All Implemented Interfaces:
RetryPolicy
A
RetryPolicy implementation that uses exponential backoff between retry attempts.
This policy retries on server-side errors (HTTP 5xx) and transient network exceptions, but does not retry on client errors (HTTP 4xx) or local file I/O errors.
-
Nested Class Summary
Nested Classes -
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
Description copied from interface:RetryPolicyDetermines whether a failed download should be retried based on the exception.- Specified by:
isRetryablein interfaceRetryPolicy- Parameters:
e- the exception thrown during the download attempt- Returns:
trueif the download should be retried,falseotherwise
-
getDelayMillis
public long getDelayMillis(int attempt) Description copied from interface:RetryPolicyReturns the delay in milliseconds before the next retry attempt.- Specified by:
getDelayMillisin interfaceRetryPolicy- Parameters:
attempt- the current attempt number (1-based, so 1 means the delay before the first retry)- Returns:
- the delay in milliseconds
-
maxRetries
public int maxRetries()Description copied from interface:RetryPolicyReturns the maximum number of retry attempts.- Specified by:
maxRetriesin interfaceRetryPolicy- Returns:
- the maximum number of retries (0 means no retries)
-
newBuilder
-