Class RetryPolicy.Builder
java.lang.Object
express.mvp.myra.transport.error.RetryPolicy.Builder
- Enclosing class:
RetryPolicy
Builder for
RetryPolicy.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbackoffMultiplier(double multiplier) Sets the backoff multiplier.build()Builds the retry policy.initialDelay(Duration delay) Sets the initial delay before first retry.jitterFactor(double jitter) Sets the jitter factor.maxAttempts(int maxAttempts) Sets the maximum number of attempts.Sets the maximum delay cap.maxTotalDuration(Duration duration) Sets maximum total duration for all retry attempts.retryNetwork(boolean retry) Sets whether to retry network errors.retryResource(boolean retry) Sets whether to retry resource errors.retryTransient(boolean retry) Sets whether to retry transient errors.retryUnknown(boolean retry) Sets whether to retry unknown errors.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
maxAttempts
Sets the maximum number of attempts.- Parameters:
maxAttempts- max attempts (must be >= 1)- Returns:
- this builder
-
initialDelay
Sets the initial delay before first retry.- Parameters:
delay- initial delay- Returns:
- this builder
-
maxDelay
Sets the maximum delay cap.- Parameters:
maxDelay- maximum delay- Returns:
- this builder
-
backoffMultiplier
Sets the backoff multiplier.- Parameters:
multiplier- multiplier (1.0 = fixed delay, 2.0 = double each time)- Returns:
- this builder
-
jitterFactor
Sets the jitter factor.- Parameters:
jitter- jitter factor (0.0-1.0)- Returns:
- this builder
-
maxTotalDuration
Sets maximum total duration for all retry attempts.- Parameters:
duration- maximum duration (0 = no limit)- Returns:
- this builder
-
retryTransient
Sets whether to retry transient errors.- Parameters:
retry- true to retry- Returns:
- this builder
-
retryNetwork
Sets whether to retry network errors.- Parameters:
retry- true to retry- Returns:
- this builder
-
retryResource
Sets whether to retry resource errors.- Parameters:
retry- true to retry- Returns:
- this builder
-
retryUnknown
Sets whether to retry unknown errors.- Parameters:
retry- true to retry- Returns:
- this builder
-
build
-