Package com.shri.restinpeace
Class RetryConfig.Builder
java.lang.Object
com.shri.restinpeace.RetryConfig.Builder
- Enclosing class:
- RetryConfig
Builds a
RetryConfig.-
Method Summary
Modifier and TypeMethodDescriptionbackoffMultiplier(double backoffMultiplier) Sets the factor the delay is multiplied by after each retry.build()Builds the config.delayMillis(long delayMillis) Sets how long to wait before the first retry.idempotent(boolean idempotent) Sets whether to send a stableIdempotency-Key.jitterFactor(double jitterFactor) Sets the jitter fraction applied to each computed delay.retryOnStatus(int... retryOnStatus) Sets the HTTP status codes that count as a failure worth retrying.times(int times) Sets the maximum number of attempts in total.
-
Method Details
-
times
Sets the maximum number of attempts in total.- Parameters:
times- the maximum number of attempts; must be at least 1- Returns:
- this builder
-
delayMillis
Sets how long to wait before the first retry.- Parameters:
delayMillis- the initial delay in milliseconds- Returns:
- this builder
-
backoffMultiplier
Sets the factor the delay is multiplied by after each retry.- Parameters:
backoffMultiplier- the backoff multiplier- Returns:
- this builder
-
jitterFactor
Sets the jitter fraction applied to each computed delay.- Parameters:
jitterFactor- the jitter fraction; must be between 0.0 and 1.0 inclusive- Returns:
- this builder
-
retryOnStatus
Sets the HTTP status codes that count as a failure worth retrying.- Parameters:
retryOnStatus- the retryable status codes- Returns:
- this builder
-
idempotent
Sets whether to send a stableIdempotency-Key.- Parameters:
idempotent- whether to send a stableIdempotency-Key- Returns:
- this builder
-
build
Builds the config.- Returns:
- the built config
-