Package io.github.resilience4j.core
Interface IntervalFunction
- All Superinterfaces:
java.util.function.Function<java.lang.Integer,java.lang.Long>
- 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 IntervalFunction
extends java.util.function.Function<java.lang.Integer,java.lang.Long>
An IntervalFunction which can be used to calculate the wait interval. The input parameter of the
function is the number of attempts (attempt), the output parameter the wait interval in
milliseconds. The attempt parameter starts at 1 and increases with every further attempt.
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_INITIAL_INTERVAL
static double
DEFAULT_MULTIPLIER
static double
DEFAULT_RANDOMIZATION_FACTOR
-
Method Summary
Static Methods Modifier and Type Method Description static IntervalFunction
of(long intervalMillis)
Creates an IntervalFunction which returns a fixed interval in milliseconds.static IntervalFunction
of(long intervalMillis, java.util.function.Function<java.lang.Long,java.lang.Long> backoffFunction)
static IntervalFunction
of(java.time.Duration interval)
Creates an IntervalFunction which returns a fixed interval specified by a givenDuration
.static IntervalFunction
of(java.time.Duration interval, java.util.function.Function<java.lang.Long,java.lang.Long> backoffFunction)
static IntervalFunction
ofDefaults()
Creates an IntervalFunction which returns a fixed default interval of 500 [ms].static IntervalFunction
ofExponentialBackoff()
static IntervalFunction
ofExponentialBackoff(long initialIntervalMillis)
static IntervalFunction
ofExponentialBackoff(long initialIntervalMillis, double multiplier)
static IntervalFunction
ofExponentialBackoff(long initialIntervalMillis, double multiplier, long maxIntervalMillis)
static IntervalFunction
ofExponentialBackoff(java.time.Duration initialInterval)
static IntervalFunction
ofExponentialBackoff(java.time.Duration initialInterval, double multiplier)
static IntervalFunction
ofExponentialBackoff(java.time.Duration initialInterval, double multiplier, java.time.Duration maxInterval)
static IntervalFunction
ofExponentialRandomBackoff()
static IntervalFunction
ofExponentialRandomBackoff(long initialIntervalMillis)
static IntervalFunction
ofExponentialRandomBackoff(long initialIntervalMillis, double multiplier)
static IntervalFunction
ofExponentialRandomBackoff(long initialIntervalMillis, double multiplier, double randomizationFactor)
static IntervalFunction
ofExponentialRandomBackoff(long initialIntervalMillis, double multiplier, double randomizationFactor, long maxIntervalMillis)
static IntervalFunction
ofExponentialRandomBackoff(long initialIntervalMillis, double multiplier, long maxIntervalMillis)
static IntervalFunction
ofExponentialRandomBackoff(java.time.Duration initialInterval)
static IntervalFunction
ofExponentialRandomBackoff(java.time.Duration initialInterval, double multiplier)
static IntervalFunction
ofExponentialRandomBackoff(java.time.Duration initialInterval, double multiplier, double randomizationFactor)
static IntervalFunction
ofExponentialRandomBackoff(java.time.Duration initialInterval, double multiplier, double randomizationFactor, java.time.Duration maxInterval)
static IntervalFunction
ofExponentialRandomBackoff(java.time.Duration initialInterval, double multiplier, java.time.Duration maxInterval)
static IntervalFunction
ofRandomized()
static IntervalFunction
ofRandomized(long intervalMillis)
static IntervalFunction
ofRandomized(long intervalMillis, double randomizationFactor)
static IntervalFunction
ofRandomized(java.time.Duration interval)
static IntervalFunction
ofRandomized(java.time.Duration interval, double randomizationFactor)
-
Field Details
-
DEFAULT_INITIAL_INTERVAL
static final long DEFAULT_INITIAL_INTERVAL- See Also:
- Constant Field Values
-
DEFAULT_MULTIPLIER
static final double DEFAULT_MULTIPLIER- See Also:
- Constant Field Values
-
DEFAULT_RANDOMIZATION_FACTOR
static final double DEFAULT_RANDOMIZATION_FACTOR- See Also:
- Constant Field Values
-
-
Method Details
-
ofDefaults
Creates an IntervalFunction which returns a fixed default interval of 500 [ms].- Returns:
- returns an IntervalFunction which returns a fixed default interval of 500 [ms]
-
of
static IntervalFunction of(long intervalMillis, java.util.function.Function<java.lang.Long,java.lang.Long> backoffFunction) -
of
static IntervalFunction of(java.time.Duration interval, java.util.function.Function<java.lang.Long,java.lang.Long> backoffFunction) -
of
Creates an IntervalFunction which returns a fixed interval in milliseconds.- Parameters:
intervalMillis
- the interval in milliseconds- Returns:
- an IntervalFunction which returns a fixed interval in milliseconds.
-
of
Creates an IntervalFunction which returns a fixed interval specified by a givenDuration
.- Parameters:
interval
- the interval- Returns:
- an IntervalFunction which returns a fixed interval specified by a given
Duration
.
-
ofRandomized
-
ofRandomized
-
ofRandomized
-
ofRandomized
-
ofRandomized
-
ofExponentialBackoff
static IntervalFunction ofExponentialBackoff(long initialIntervalMillis, double multiplier, long maxIntervalMillis) -
ofExponentialBackoff
static IntervalFunction ofExponentialBackoff(java.time.Duration initialInterval, double multiplier, java.time.Duration maxInterval) -
ofExponentialBackoff
-
ofExponentialBackoff
static IntervalFunction ofExponentialBackoff(java.time.Duration initialInterval, double multiplier) -
ofExponentialBackoff
-
ofExponentialBackoff
-
ofExponentialBackoff
-
ofExponentialRandomBackoff
static IntervalFunction ofExponentialRandomBackoff(long initialIntervalMillis, double multiplier, double randomizationFactor, long maxIntervalMillis) -
ofExponentialRandomBackoff
static IntervalFunction ofExponentialRandomBackoff(long initialIntervalMillis, double multiplier, double randomizationFactor) -
ofExponentialRandomBackoff
static IntervalFunction ofExponentialRandomBackoff(java.time.Duration initialInterval, double multiplier, double randomizationFactor, java.time.Duration maxInterval) -
ofExponentialRandomBackoff
static IntervalFunction ofExponentialRandomBackoff(java.time.Duration initialInterval, double multiplier, double randomizationFactor) -
ofExponentialRandomBackoff
static IntervalFunction ofExponentialRandomBackoff(long initialIntervalMillis, double multiplier, long maxIntervalMillis) -
ofExponentialRandomBackoff
-
ofExponentialRandomBackoff
static IntervalFunction ofExponentialRandomBackoff(java.time.Duration initialInterval, double multiplier, java.time.Duration maxInterval) -
ofExponentialRandomBackoff
static IntervalFunction ofExponentialRandomBackoff(java.time.Duration initialInterval, double multiplier) -
ofExponentialRandomBackoff
-
ofExponentialRandomBackoff
-
ofExponentialRandomBackoff
-