Module io.helidon.faulttolerance
Package io.helidon.faulttolerance
Class Retry.ExponentialRetryPolicy
- java.lang.Object
-
- io.helidon.faulttolerance.Retry.ExponentialRetryPolicy
-
- All Implemented Interfaces:
Retry.RetryPolicy
- Enclosing interface:
- Retry
public static class Retry.ExponentialRetryPolicy extends Object implements Retry.RetryPolicy
A retry policy that increases the delay time following an exponential sequence. Allowed elements that are also annotated with@Retry
. Expected sequence in case factor is 2: initial delay, 2 * initial delay + jitter, 4 * initial delay + jitter, 8 * initial delay + jitter, etc.maxDelay
is used to prevent endless waiting.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Retry.ExponentialRetryPolicy.Builder
Fluent API builder forRetry.ExponentialRetryPolicy
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Retry.ExponentialRetryPolicy.Builder
builder()
A new fluent API builder to configure instances ofRetry
.Optional<Long>
nextDelayMillis(long firstCallMillis, long lastDelay, int call)
Return next delay in milliseconds, or an empty optional to finish retries.
-
-
-
Method Detail
-
builder
public static Retry.ExponentialRetryPolicy.Builder builder()
A new fluent API builder to configure instances ofRetry
.- Returns:
- a new builder
-
nextDelayMillis
public Optional<Long> nextDelayMillis(long firstCallMillis, long lastDelay, int call)
Description copied from interface:Retry.RetryPolicy
Return next delay in milliseconds, or an empty optional to finish retries.- Specified by:
nextDelayMillis
in interfaceRetry.RetryPolicy
- Parameters:
firstCallMillis
- milliseconds recorded before the first call usingSystem.currentTimeMillis()
lastDelay
- last delay that was used (0 for the first failed call)call
- call index (0 for the first failed call)- Returns:
- how long to wait before trying again, or empty to notify this is the end of retries
-
-