@FunctionalInterface public interface DelayStrategy
| Modifier and Type | Method and Description |
|---|---|
static DelayStrategy |
constant(long delayInMilliseconds)
Create a delay strategy that applies a constant delay as long as the criteria is met.
|
static DelayStrategy |
exponential(long initialDelayInMilliseconds,
long maxDelayInMilliseconds)
Create a delay strategy that applies an exponentially-increasing delay as long as the criteria is met.
|
static DelayStrategy |
exponential(long initialDelayInMilliseconds,
long maxDelayInMilliseconds,
double backOffMultiplier)
Create a delay strategy that applies an exponentially-increasing delay as long as the criteria is met.
|
static DelayStrategy |
linear(long delayInMilliseconds)
Create a delay strategy that applies an linearly-increasing delay as long as the criteria is met.
|
static DelayStrategy |
none()
Create a delay strategy that never delays.
|
boolean |
sleepWhen(boolean criteria)
Attempt to sleep when the specified criteria is met.
|
default boolean |
sleepWhen(BooleanSupplier criteria)
Attempt to sleep when the specified criteria is met.
|
default boolean sleepWhen(BooleanSupplier criteria)
criteria - true if this method should sleep, or false if there is no need to sleeptrue if this invocation caused the thread to sleep, or false if this method did not sleepboolean sleepWhen(boolean criteria)
criteria - true if this method should sleep, or false if there is no need to sleeptrue if this invocation caused the thread to sleep, or false if this method did not sleepstatic DelayStrategy none()
static DelayStrategy constant(long delayInMilliseconds)
delayInMilliseconds - the initial delay; must be positivestatic DelayStrategy linear(long delayInMilliseconds)
delayInMilliseconds - the initial delay; must be positivestatic DelayStrategy exponential(long initialDelayInMilliseconds, long maxDelayInMilliseconds)
initialDelayInMilliseconds - the initial delay; must be positivemaxDelayInMilliseconds - the maximum delay; must be greater than the initial delaystatic DelayStrategy exponential(long initialDelayInMilliseconds, long maxDelayInMilliseconds, double backOffMultiplier)
initialDelayInMilliseconds - the initial delay; must be positivemaxDelayInMilliseconds - the maximum delay; must be greater than the initial delaybackOffMultiplier - the factor by which the delay increases each passCopyright © 2021 JBoss by Red Hat. All rights reserved.