Class EqualJitterBackoffStrategy
- java.lang.Object
-
- software.amazon.awssdk.core.retry.backoff.EqualJitterBackoffStrategy
-
- All Implemented Interfaces:
BackoffStrategy
,ToCopyableBuilder<EqualJitterBackoffStrategy.Builder,EqualJitterBackoffStrategy>
public final class EqualJitterBackoffStrategy extends Object implements BackoffStrategy, ToCopyableBuilder<EqualJitterBackoffStrategy.Builder,EqualJitterBackoffStrategy>
Backoff strategy that uses equal jitter for computing the delay before the next retry. An equal jitter backoff strategy will first compute an exponential delay based on the current number of retries, base delay and max delay. The final computed delay before the next retry will keep half of this computed delay plus a random delay computed as a random number between 0 and half of the exponential delay plus one. For example, using a base delay of 100, a max backoff time of 10000 an exponential delay of 400 is computed for a second retry attempt. The final computed delay before the next retry will be half of the computed exponential delay, in this case 200, plus a random number between 0 and 201. Therefore the range for delay would be between 200 and 401. This is in contrast toFullJitterBackoffStrategy
where the final computed delay before the next retry will be between 0 and the computed exponential delay.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
EqualJitterBackoffStrategy.Builder
-
Field Summary
-
Fields inherited from interface software.amazon.awssdk.core.retry.backoff.BackoffStrategy
RETRIES_ATTEMPTED_CEILING
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EqualJitterBackoffStrategy.Builder
builder()
Duration
computeDelayBeforeNextRetry(RetryPolicyContext context)
Compute the delay before the next retry request.boolean
equals(Object o)
int
hashCode()
EqualJitterBackoffStrategy.Builder
toBuilder()
String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.core.retry.backoff.BackoffStrategy
calculateExponentialDelay
-
Methods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
-
-
-
Method Detail
-
computeDelayBeforeNextRetry
public Duration computeDelayBeforeNextRetry(RetryPolicyContext context)
Description copied from interface:BackoffStrategy
Compute the delay before the next retry request. This strategy is only consulted when there will be a next retry.- Specified by:
computeDelayBeforeNextRetry
in interfaceBackoffStrategy
- Parameters:
context
- Context about the state of the last request and information about the number of requests made.- Returns:
- Amount of time in milliseconds to wait before the next attempt. Must be non-negative (can be zero).
-
toBuilder
public EqualJitterBackoffStrategy.Builder toBuilder()
- Specified by:
toBuilder
in interfaceToCopyableBuilder<EqualJitterBackoffStrategy.Builder,EqualJitterBackoffStrategy>
-
builder
public static EqualJitterBackoffStrategy.Builder builder()
-
-