Package com.pain001.sdk
Class RetryPolicy.Builder
java.lang.Object
com.pain001.sdk.RetryPolicy.Builder
- Enclosing class:
RetryPolicy
Builds a
RetryPolicy.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the policy.initialBackoff(Duration initialBackoff) The wait before the first retry, before jitter (default 200 ms).maxAttempts(int maxAttempts) The number of attempts in all, including the first (default 3); 1 disables retries.maxBackoff(Duration maxBackoff) The longest wait before any retry (default 5 s), and the longest Retry-After honoured.
-
Method Details
-
maxAttempts
The number of attempts in all, including the first (default 3); 1 disables retries.- Parameters:
maxAttempts- at least 1- Returns:
- this builder
-
initialBackoff
The wait before the first retry, before jitter (default 200 ms).- Parameters:
initialBackoff- a positive duration- Returns:
- this builder
-
maxBackoff
The longest wait before any retry (default 5 s), and the longest Retry-After honoured.- Parameters:
maxBackoff- a positive duration, no shorter than the initial backoff- Returns:
- this builder
-
build
Builds the policy.- Returns:
- the immutable policy
- Throws:
IllegalArgumentException- whenmaxAttemptsis below 1, a backoff is missing or not positive, ormaxBackoffis shorter thaninitialBackoff
-