Class RetryUtils

java.lang.Object
dev.hogwai.dynamodb.simplified.internal.RetryUtils

public final class RetryUtils extends Object
Shared utility for retry-related operations.

Consolidates duplicated backoff and retry logic across sync builders.

  • Field Details

    • DEFAULT_BASE_BACKOFF_MS

      public static final long DEFAULT_BASE_BACKOFF_MS
      Default base backoff in milliseconds for exponential retry.
      See Also:
    • DEFAULT_MAX_RETRIES

      public static final int DEFAULT_MAX_RETRIES
      Default maximum number of retry attempts.
      See Also:
  • Method Details

    • sleepWithBackoff

      public static boolean sleepWithBackoff(int attempt, long baseBackoffMs)
      Sleeps with exponential backoff plus jitter.

      Formula: baseBackoffMs * (1 << attempt) + random(baseBackoffMs)

      Parameters:
      attempt - the current retry attempt (0-based)
      baseBackoffMs - the base backoff in milliseconds
      Returns:
      true if the sleep was interrupted (caller should abort retry), false if the sleep completed normally
    • sleepWithBackoff

      public static boolean sleepWithBackoff(int attempt)
      Sleeps with exponential backoff plus jitter using the default base of 100ms.
      Parameters:
      attempt - the current retry attempt (0-based)
      Returns:
      true if interrupted, false otherwise
      See Also: