public final class RetryableSphereClientBuilder extends Base
| Modifier and Type | Field and Description |
|---|---|
protected static long |
DEFAULT_INITIAL_RETRY_DELAY |
protected static long |
DEFAULT_MAX_DELAY |
protected static int |
DEFAULT_MAX_PARALLEL_REQUESTS |
protected static int |
DEFAULT_MAX_RETRY_ATTEMPT |
| Modifier and Type | Method and Description |
|---|---|
SphereClient |
build()
creates a SphereClient using the class configuration values.
|
protected SphereClient |
decorateSphereClient(SphereClient underlyingClient,
RetryAction retryAction,
int maxParallelRequests) |
static RetryableSphereClientBuilder |
of(SphereClientConfig sphereClientConfig,
HttpClient httpClient)
Creates a new instance of
RetryableSphereClientBuilder given a SphereClientConfig
responsible for creation of a SphereClient. |
RetryableSphereClientBuilder |
withInitialDelay(long initialDelay)
Sets the initialDelay value in milliseconds.
|
RetryableSphereClientBuilder |
withMaxDelay(long maxDelay)
Sets the maxDelay value value in milliseconds.
|
RetryableSphereClientBuilder |
withMaxParallelRequests(int maxParallelRequests)
Sets the Max Parallel Requests value, It should be always positive number.
|
RetryableSphereClientBuilder |
withMaxRetryAttempt(int maxRetryAttempt)
Sets the Max Retry value, It should be greater than 1 for the Retry attempt.
|
RetryableSphereClientBuilder |
withStatusCodesToRetry(List<Integer> statusCodesToRetry)
Sets the Retry Error Status Codes.
|
protected static final long DEFAULT_MAX_DELAY
protected static final long DEFAULT_INITIAL_RETRY_DELAY
protected static final int DEFAULT_MAX_RETRY_ATTEMPT
protected static final int DEFAULT_MAX_PARALLEL_REQUESTS
public static RetryableSphereClientBuilder of(@Nonnull SphereClientConfig sphereClientConfig, @Nonnull HttpClient httpClient)
RetryableSphereClientBuilder given a SphereClientConfig
responsible for creation of a SphereClient.sphereClientConfig - the client configuration for the client.httpClient - client to execute requestsRetryableSphereClientBuilder.public RetryableSphereClientBuilder withMaxDelay(long maxDelay)
maxDelay - - build with maxDelay value.RetryableSphereClientBuilder with given maxDelay value.public RetryableSphereClientBuilder withInitialDelay(long initialDelay)
initialDelay - - build with initialDelay value.
If initialDelay is equal or greater than maxDelay then, a IllegalArgumentException will be thrown.RetryableSphereClientBuilder with given initialDelay value.public RetryableSphereClientBuilder withMaxRetryAttempt(int maxRetryAttempt)
maxRetryAttempt - - build with maxRetries value.
If maxRetryAttempt is less than 1 then, a IllegalArgumentException will be thrown.RetryableSphereClientBuilder with given maxRetries value.public RetryableSphereClientBuilder withMaxParallelRequests(int maxParallelRequests)
maxParallelRequests - - build with maxParallelRequests value.
If maxParallelRequests is less than 1 then, a IllegalArgumentException will be thrown.RetryableSphereClientBuilder with given maxParallelRequests value.public RetryableSphereClientBuilder withStatusCodesToRetry(List<Integer> statusCodesToRetry)
statusCodesToRetry - - build with retryErrorStatusCodes.RetryableSphereClientBuilder with given retryErrorStatusCodes.public SphereClient build()
SphereClientprotected SphereClient decorateSphereClient(@Nonnull SphereClient underlyingClient, @Nonnull RetryAction retryAction, int maxParallelRequests)