Class RetryConfiguration
java.lang.Object
io.fluxzero.common.RetryConfiguration
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionresolveDelay(RetryStatus status) Resolves the delay duration for the next retry attempt based on the providedRetryStatus.
-
Constructor Details
-
RetryConfiguration
public RetryConfiguration()
-
-
Method Details
-
resolveDelay
Resolves the delay duration for the next retry attempt based on the providedRetryStatus. 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.
-