Class RetryConfiguration

java.lang.Object
io.fluxzero.common.RetryConfiguration

public class RetryConfiguration extends Object
Configuration for retry behavior when executing a task using TimingUtils.retryOnFailure(Runnable, Duration).

This class encapsulates options such as retry delay, maximum number of retries, error filtering, and logging callbacks to be invoked on success or failure.

Usage Example

RetryConfiguration config = RetryConfiguration.builder()
    .delay(Duration.ofSeconds(2))
    .maxRetries(5)
    .errorTest(e -> e instanceof IOException)
    .build();
See Also:
  • Constructor Details

    • RetryConfiguration

      public RetryConfiguration()
  • Method Details

    • resolveDelay

      public Duration resolveDelay(RetryStatus status)
      Resolves the delay duration for the next retry attempt based on the provided RetryStatus. If a delay function has been defined, it applies this function to the given status to compute the delay. If the computed delay is null, or if no delay function is defined, it returns the default delay.
      Parameters:
      status - the current status of the retry operation containing retry attempt details.
      Returns:
      the delay duration to apply before the next retry attempt.