Package io.vertx.circuitbreaker
Interface RetryPolicy
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface RetryPolicy
A policy for retry execution.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static RetryPolicy
constantDelay(long delay)
Create a constant delay retry policy.long
delay(Throwable failure, int retryCount)
Compute a delay in milliseconds before retry is executed.static RetryPolicy
exponentialDelayWithJitter(long initialDelay, long maxDelay)
Create an exponential delay with jitter retry policy.static RetryPolicy
linearDelay(long initialDelay, long maxDelay)
Create a linear delay retry policy.
-
-
-
Method Detail
-
constantDelay
static RetryPolicy constantDelay(long delay)
Create a constant delay retry policy.- Parameters:
delay
- the constant delay in milliseconds
-
linearDelay
static RetryPolicy linearDelay(long initialDelay, long maxDelay)
Create a linear delay retry policy.- Parameters:
initialDelay
- the initial delay in millisecondsmaxDelay
- maximum delay in milliseconds
-
exponentialDelayWithJitter
static RetryPolicy exponentialDelayWithJitter(long initialDelay, long maxDelay)
Create an exponential delay with jitter retry policy.Based on the Full Jitter approach described in Exponential Backoff And Jitter.
- Parameters:
initialDelay
- the initial delay in millisecondsmaxDelay
- maximum delay in milliseconds
-
delay
long delay(Throwable failure, int retryCount)
Compute a delay in milliseconds before retry is executed.- Parameters:
failure
- the failure of the previous execution attemptretryCount
- the number of times operation has been retried already- Returns:
- a delay in milliseconds before retry is executed
-
-