Class Retry

java.lang.Object
co.yellowdog.platform.clients.retry.Retry

public class Retry extends Object
Manages retry logic.

This will always use an exponential backoff algorithm with jitter.

  • Method Details

    • builder

      public static Retry.Builder builder(@NonNull @NonNull Duration baseBackoffPeriod)
    • retry

      public <T> T retry(Supplier<T> retryable)
      Retry the given supplier. Any exceptions thrown by the supplier will result in a retry.
      Type Parameters:
      T - the type of the result.
      Parameters:
      retryable - the supplier to retry.
      Returns:
      the result of the supplier.
    • retryAsync

      public <T> CompletableFuture<T> retryAsync(Supplier<CompletionStage<T>> retryable)
      Asynchronously retry the given async supplier. Any exceptions thrown by the supplier will result in a retry.
      Type Parameters:
      T - the type of the result.
      Parameters:
      retryable - the async supplier to retry.
      Returns:
      the future to wait on for the result.