| Modifier and Type | Method and Description |
|---|---|
static Delay |
constant(int delay,
TimeUnit timeUnit)
Creates a new
ConstantDelay. |
abstract long |
createDelay(long attempt)
Calculate a specific delay based on the attempt.
|
static Delay |
exponential()
Creates a new
ExponentialDelay with default boundaries and factor (1, 2, 4, 8, 16, 32...). |
static Delay |
exponential(long lower,
long upper,
TimeUnit unit,
int powersOf)
Creates a new
ExponentialDelay on with custom boundaries and factor (eg. with upper 9000, lower 0, powerOf 10: 1,
10, 100, 1000, 9000, 9000, 9000, ...). |
TimeUnit |
getTimeUnit()
|
public abstract long createDelay(long attempt)
attempt - the attempt to calculate the delay from.public static Delay constant(int delay, TimeUnit timeUnit)
ConstantDelay.delay - the delay, must be greater or equal to 0timeUnit - the unit of the delay.ExponentialDelay.public static Delay exponential()
ExponentialDelay with default boundaries and factor (1, 2, 4, 8, 16, 32...). The delay begins with
1 and is capped at 30 milliseconds after reaching the 16th attempt.ExponentialDelay.public static Delay exponential(long lower, long upper, TimeUnit unit, int powersOf)
ExponentialDelay on with custom boundaries and factor (eg. with upper 9000, lower 0, powerOf 10: 1,
10, 100, 1000, 9000, 9000, 9000, ...).lower - the lower boundary, must be non-negativeupper - the upper boundary, must be greater than the lower boundaryunit - the unit of the delay.powersOf - the base for exponential growth (eg. powers of 2, powers of 10, etc...), must be non-negative and greater
than 1ExponentialDelay.Copyright © 2016. All rights reserved.