public static interface RetryPolicy.Builder extends CopyableBuilder<RetryPolicy.Builder,RetryPolicy>
Modifier and Type | Method and Description |
---|---|
boolean |
additionalRetryConditionsAllowed() |
RetryPolicy.Builder |
additionalRetryConditionsAllowed(boolean additionalRetryConditionsAllowed)
Configure whether further conditions can be added to this policy after it is created.
|
BackoffStrategy |
backoffStrategy() |
RetryPolicy.Builder |
backoffStrategy(BackoffStrategy backoffStrategy)
Configure the backoff strategy that should be used for waiting in between retry attempts.
|
RetryPolicy |
build() |
RetryPolicy.Builder |
fastFailRateLimiting(Boolean fastFailRateLimiting)
Whether the client should immediately fail the request when not enough capacity is immediately available from the
rate limiter to execute the request, instead of waiting for capacity to be available.
|
Boolean |
isFastFailRateLimiting()
Whether the client should immediately fail the request when not enough capacity is immediately available from the
rate limiter to execute the request, instead of waiting for capacity to be available.
|
Integer |
numRetries() |
RetryPolicy.Builder |
numRetries(Integer numRetries)
Configure the maximum number of times that a single request should be retried, assuming it fails for a retryable error.
|
RetryCondition |
retryCapacityCondition() |
RetryPolicy.Builder |
retryCapacityCondition(RetryCondition retryCapacityCondition)
Configure the
RetryCondition that should be used to throttle the number of retries attempted by the SDK client
as a whole. |
RetryCondition |
retryCondition() |
RetryPolicy.Builder |
retryCondition(RetryCondition retryCondition)
Configure the condition under which the request should be retried.
|
BackoffStrategy |
throttlingBackoffStrategy() |
RetryPolicy.Builder |
throttlingBackoffStrategy(BackoffStrategy backoffStrategy)
Configure the backoff strategy that should be used for waiting in between retry attempts after a throttling error
is encountered.
|
copy
applyMutation
RetryPolicy.Builder additionalRetryConditionsAllowed(boolean additionalRetryConditionsAllowed)
RetryCondition.defaultRetryCondition()
.
By default, this is true.
boolean additionalRetryConditionsAllowed()
RetryPolicy.Builder backoffStrategy(BackoffStrategy backoffStrategy)
throttlingBackoffStrategy(BackoffStrategy)
is used instead.BackoffStrategy backoffStrategy()
backoffStrategy(BackoffStrategy)
RetryPolicy.Builder throttlingBackoffStrategy(BackoffStrategy backoffStrategy)
backoffStrategy(BackoffStrategy)
is
used instead.BackoffStrategy throttlingBackoffStrategy()
RetryPolicy.Builder retryCondition(RetryCondition retryCondition)
While this can be any interface that implements RetryCondition
, it is encouraged to use
numRetries(Integer)
when attempting to limit the number of times the SDK will retry an attempt or the
retryCapacityCondition(RetryCondition)
when attempting to configure the throttling of retries. This guidance
is because the SDK uses the RetryPolicy.aggregateRetryCondition()
when determining whether or not to retry a request,
and the aggregateRetryCondition
includes the numRetries
and retryCapacityCondition
in its
determination.
RetryCondition retryCondition()
retryCondition(RetryCondition)
RetryPolicy.Builder retryCapacityCondition(RetryCondition retryCapacityCondition)
RetryCondition
that should be used to throttle the number of retries attempted by the SDK client
as a whole.
While any RetryCondition
(or null) can be used, by convention these conditions are usually stateful and work
globally for the whole client to limit the overall capacity of the client to execute retries.
By default the TokenBucketRetryCondition
is used. This can be disabled by setting the value to null
(not RetryPolicy#none()
, which would completely disable retries).
RetryCondition retryCapacityCondition()
retryCapacityCondition(RetryCondition)
RetryPolicy.Builder numRetries(Integer numRetries)
Integer numRetries()
numRetries(Integer)
RetryPolicy.Builder fastFailRateLimiting(Boolean fastFailRateLimiting)
fastFailRateLimiting
- Whether to fast fail.Boolean isFastFailRateLimiting()
RetryPolicy build()
build
in interface Buildable
build
in interface SdkBuilder<RetryPolicy.Builder,RetryPolicy>
Copyright © 2023. All rights reserved.