Class ExponentialDelayWithHalfJitter
java.lang.Object
software.amazon.awssdk.retries.api.internal.backoff.ExponentialDelayWithHalfJitter
- All Implemented Interfaces:
BackoffStrategy
@SdkProtectedApi
public final class ExponentialDelayWithHalfJitter
extends Object
implements BackoffStrategy
Strategy that waits for a random period of time between a lower bound x and an exponentially increasing amount of time between
each subsequent attempt of the same call. The lower bound x is half the amount of the computed exponential delay.
Specifically, the first attempt waits 0ms, and each subsequent attempt waits between
min(maxDelay, baseDelay * (1 << (attempt - 2))) / 2 and min(maxDelay, baseDelay * (1 << (attempt - 2))).
This is in contrast to ExponentialDelayWithJitter where the final computed delay before the next retry will be between
0 and the computed exponential delay.
-
Constructor Summary
ConstructorsConstructorDescriptionExponentialDelayWithHalfJitter(Supplier<Random> randomSupplier, Duration baseDelay, Duration maxDelay) -
Method Summary
Modifier and TypeMethodDescriptioncomputeDelay(int attempt) Compute the amount of time to wait before the provided attempt number is executed.toString()
-
Constructor Details
-
ExponentialDelayWithHalfJitter
-
-
Method Details
-
computeDelay
Description copied from interface:BackoffStrategyCompute the amount of time to wait before the provided attempt number is executed.- Specified by:
computeDelayin interfaceBackoffStrategy- Parameters:
attempt- The attempt to compute the delay for, starting at one.
-
toString
-