Module de.cuioss.http
Package de.cuioss.http.client.retry
Class ExponentialBackoffRetryStrategy.Builder
java.lang.Object
de.cuioss.http.client.retry.ExponentialBackoffRetryStrategy.Builder
- Enclosing class:
ExponentialBackoffRetryStrategy
Builder for creating ExponentialBackoffRetryStrategy instances with custom configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbackoffMultiplier(double backoffMultiplier) Sets the backoff multiplier for exponential delay increase.build()Builds the ExponentialBackoffRetryStrategy with the configured parameters.initialDelay(Duration initialDelay) Sets the initial delay before the first retry.jitterFactor(double jitterFactor) Sets the jitter factor for randomizing delays.maxAttempts(int maxAttempts) Sets the maximum number of retry attempts.Sets the maximum delay between retries.retryMetrics(RetryMetrics retryMetrics) Sets the metrics recorder for retry operations.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
maxAttempts
Sets the maximum number of retry attempts.- Parameters:
maxAttempts- maximum attempts (must be positive)- Returns:
- this builder
-
initialDelay
Sets the initial delay before the first retry.- Parameters:
initialDelay- initial delay (must not be null or negative)- Returns:
- this builder
-
backoffMultiplier
Sets the backoff multiplier for exponential delay increase.- Parameters:
backoffMultiplier- multiplier (must be >= 1.0)- Returns:
- this builder
-
maxDelay
Sets the maximum delay between retries.- Parameters:
maxDelay- maximum delay (must not be null or negative)- Returns:
- this builder
-
jitterFactor
Sets the jitter factor for randomizing delays.- Parameters:
jitterFactor- jitter factor (0.0 = no jitter, 1.0 = 100% jitter, must be between 0.0 and 1.0)- Returns:
- this builder
-
retryMetrics
Sets the metrics recorder for retry operations.- Parameters:
retryMetrics- metrics recorder (must not be null, use RetryMetrics.noOp() for no metrics)- Returns:
- this builder
-
build
Builds the ExponentialBackoffRetryStrategy with the configured parameters.- Returns:
- configured retry strategy
-