Class ExponentialBackoffPolicy
java.lang.Object
io.spiffe.workloadapi.retry.ExponentialBackoffPolicy
Represents a backoff policy for performing retries using exponential increasing delays.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionExponentialBackoffPolicy(Duration initialDelay, Duration maxDelay, int maxRetries, int backoffMultiplier) -
Method Summary
Modifier and TypeMethodDescriptionCalculate the nextDelay based on a currentDelay, applying the backoff function If the calculated delay is greater than maxDelay, it returns maxDelay.booleanreachedMaxRetries(int retriesCount) Returns false if the RetryPolicy is configured with UNLIMITED_RETRIES or if the retriesCount param is lower than the maxRetries.
-
Field Details
-
DEFAULT
-
UNLIMITED_RETRIES
public static final int UNLIMITED_RETRIES- See Also:
-
-
Constructor Details
-
ExponentialBackoffPolicy
-
-
Method Details
-
nextDelay
Calculate the nextDelay based on a currentDelay, applying the backoff function If the calculated delay is greater than maxDelay, it returns maxDelay. -
reachedMaxRetries
public boolean reachedMaxRetries(int retriesCount) Returns false if the RetryPolicy is configured with UNLIMITED_RETRIES or if the retriesCount param is lower than the maxRetries.- Parameters:
retriesCount- the current number of retries- Returns:
- true if the number of retries reached the max number of retries, false otherwise
-