public class MaxTimeTerminationStrategy extends Object implements TerminationStrategy
Termination strategy that allows up to X milliseconds to have elapsed before terminating.
Constructor and Description |
---|
MaxTimeTerminationStrategy(long maxTimeInMillis) |
Modifier and Type | Method and Description |
---|---|
static MaxTimeTerminationStrategy |
ofMillis(long maxTimeInMillis)
Create a new termination strategy that allows up to the specified number of milliseconds to
have elapsed before terminating.
|
static MaxTimeTerminationStrategy |
ofMinutes(long maxTimeInMinutes)
Create a new termination strategy that allows up to the specified number of minutes to have
elapsed before terminating.
|
static MaxTimeTerminationStrategy |
ofSeconds(long maxTimeInSeconds)
Create a new termination strategy that allows up to the specified number of seconds to have
elapsed before terminating.
|
static MaxTimeTerminationStrategy |
ofTimeUnit(long maxTime,
TimeUnit timeUnit)
Create a new termination strategy that allows up to the specified number of time units to
have elapsed before terminating.
|
boolean |
shouldTerminate(WaiterConfiguration.WaitContext context)
Returns whether or not polling should be terminated.
|
@ConstructorProperties(value="maxTimeInMillis") public MaxTimeTerminationStrategy(long maxTimeInMillis)
public boolean shouldTerminate(WaiterConfiguration.WaitContext context)
TerminationStrategy
Returns whether or not polling should be terminated.
shouldTerminate
in interface TerminationStrategy
context
- The context after the last poll attempt.public static MaxTimeTerminationStrategy ofTimeUnit(long maxTime, TimeUnit timeUnit)
Create a new termination strategy that allows up to the specified number of time units to have elapsed before terminating.
maxTime
- number of time unitstimeUnit
- time unitpublic static MaxTimeTerminationStrategy ofMillis(long maxTimeInMillis)
Create a new termination strategy that allows up to the specified number of milliseconds to have elapsed before terminating.
maxTimeInMillis
- number of millisecondspublic static MaxTimeTerminationStrategy ofSeconds(long maxTimeInSeconds)
Create a new termination strategy that allows up to the specified number of seconds to have elapsed before terminating.
maxTimeInSeconds
- number of secondspublic static MaxTimeTerminationStrategy ofMinutes(long maxTimeInMinutes)
Create a new termination strategy that allows up to the specified number of minutes to have elapsed before terminating.
maxTimeInMinutes
- number of minutesCopyright © 2016–2024. All rights reserved.