Class ExponentialBackoffRetryPolicy

java.lang.Object
ai.wanaku.capabilities.sdk.runtime.camel.downloader.ExponentialBackoffRetryPolicy
All Implemented Interfaces:
RetryPolicy

public class ExponentialBackoffRetryPolicy extends Object implements 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.

  • Method Details

    • isRetryable

      public boolean isRetryable(Exception e)
      Description copied from interface: RetryPolicy
      Determines whether a failed download should be retried based on the exception.
      Specified by:
      isRetryable in interface RetryPolicy
      Parameters:
      e - the exception thrown during the download attempt
      Returns:
      true if the download should be retried, false otherwise
    • getDelayMillis

      public long getDelayMillis(int attempt)
      Description copied from interface: RetryPolicy
      Returns the delay in milliseconds before the next retry attempt.
      Specified by:
      getDelayMillis in interface RetryPolicy
      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: RetryPolicy
      Returns the maximum number of retry attempts.
      Specified by:
      maxRetries in interface RetryPolicy
      Returns:
      the maximum number of retries (0 means no retries)
    • newBuilder

      public static ExponentialBackoffRetryPolicy.Builder newBuilder()