Package com.helixframework.okhttp.retry
Class RetryInterceptor.Builder
java.lang.Object
com.helixframework.okhttp.retry.RetryInterceptor.Builder
- Enclosing class:
- RetryInterceptor
Builder for creating new instances of
RetryInterceptor.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a new instance ofRetryInterceptor.initialBackoff(long initialBackoff) Sets the number of milliseconds to initially wait before executing the first retry.maxRetries(int maxRetries) Sets the maximum number of retries to execute before returning a failed response.Predicate that determines if the request should be retried.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
maxRetries
Sets the maximum number of retries to execute before returning a failed response.This is an optional setting and defaults to '3'.
- Parameters:
maxRetries- maximum number of retries- Returns:
RetryInterceptor.Builder
-
initialBackoff
Sets the number of milliseconds to initially wait before executing the first retry.This is an optional setting and defaults to '50'.
- Parameters:
initialBackoff- number of milliseconds to initially wait for backoff- Returns:
RetryInterceptor.Builder
-
retryOn
Predicate that determines if the request should be retried.This is an optional setting and defaults to retrying any request with a 500 series http status code.
- Parameters:
retryOn- predicate to determine if the request should be retried- Returns:
RetryInterceptor.Builder
-
build
Creates a new instance ofRetryInterceptor.- Returns:
- a
RetryInterceptor - Throws:
IllegalArgumentException- when validation of the builder parameters fails
-