public class IterativePollInterval extends Object implements PollInterval
await().with().pollInterval(iterative(duration -> duration.multiply(2)), Duration.FIVE_HUNDRED_MILLISECONDS).until(..);This generates a poll interval sequence that looks like this (ms): 500, 1000, 2000, 4000, 8000, 16000, ... Note that if the user specifies a poll delay this delay will take place before the first call to
next(int, Duration)
.Modifier and Type | Class and Description |
---|---|
static interface |
IterativePollInterval.Function
The iterative poll interval function
|
Constructor and Description |
---|
IterativePollInterval(IterativePollInterval.Function function)
Generate an iterative poll interval based on the supplied function.
|
IterativePollInterval(IterativePollInterval.Function function,
Duration startDuration)
Generate a iterative poll interval based on the supplied function and start duration.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
static IterativePollInterval |
iterative(IterativePollInterval.Function function)
Syntactic sugar for creating a
IterativePollInterval . |
static IterativePollInterval |
iterative(IterativePollInterval.Function function,
Duration startDuration)
Syntactic sugar for creating a
IterativePollInterval . |
Duration |
next(int pollCount,
Duration previousDuration)
Generate the next Duration based on the supplied function.
|
IterativePollInterval |
startDuration(Duration duration)
Set the start duration of this poll interval
|
String |
toString() |
IterativePollInterval |
with()
Syntactic sugar
|
public IterativePollInterval(IterativePollInterval.Function function)
function
- The function to use.public IterativePollInterval(IterativePollInterval.Function function, Duration startDuration)
function
- The function to use.startDuration
- The start duration (initial function value)public Duration next(int pollCount, Duration previousDuration)
previousDuration
when pollCount
is 1 (i.e. the poll delay).next
in interface PollInterval
pollCount
- The number of times the condition has been polled (evaluated). Always a positive integer.previousDuration
- The duration of the previously returned poll interval.public static IterativePollInterval iterative(IterativePollInterval.Function function)
IterativePollInterval
.function
- The function to useIterativePollInterval
public static IterativePollInterval iterative(IterativePollInterval.Function function, Duration startDuration)
IterativePollInterval
.function
- The function to usestartDuration
- The start duration (initial function value)IterativePollInterval
public IterativePollInterval with()
IterativePollInterval
public IterativePollInterval startDuration(Duration duration)
IterativePollInterval
with the given start durationCopyright © 2010–2016. All rights reserved.