Modifier and Type | Field and Description |
---|---|
static Timeout |
DISABLED
A disabled timeout represented as 0
MILLISECONDS . |
static Timeout |
ZERO_MILLISECONDS
A zero milliseconds
Timeout . |
MAX_VALUE, NEG_ONE_MILLISECOND, NEG_ONE_SECOND
Modifier and Type | Method and Description |
---|---|
static Timeout |
defaultsToDisabled(Timeout timeout)
|
boolean |
isDisabled()
Whether this timeout is disabled.
|
boolean |
isEnabled()
Whether this timeout is enabled.
|
static Timeout |
of(long duration,
TimeUnit timeUnit)
Creates a Timeout.
|
static Timeout |
ofDays(long days)
Creates a Timeout.
|
static Timeout |
ofHours(long hours)
Creates a Timeout.
|
static Timeout |
ofMicroseconds(long microseconds)
Creates a Timeout.
|
static Timeout |
ofMilliseconds(long milliseconds)
Creates a Timeout.
|
static Timeout |
ofMinutes(long minutes)
Creates a Timeout.
|
static Timeout |
ofNanoseconds(long nanoseconds)
Creates a Timeout.
|
static Timeout |
ofSeconds(long seconds)
Creates a Timeout.
|
static Timeout |
parse(String value)
Parses a Timeout in the format
<Integer><SPACE><TimeUnit> , for example "1,200 MILLISECONDS" |
asBoundInt, compareTo, convert, defaultsTo, defaultsToNegativeOneMillisecond, defaultsToNegativeOneSecond, defaultsToZeroMilliseconds, divide, divide, equals, getDuration, getTimeUnit, hashCode, isNonNegative, isPositive, min, sleep, timedJoin, timedWait, toDays, toHours, toMicroseconds, toMilliseconds, toMillisecondsIntBound, toMinutes, toNanoseconds, toSeconds, toSecondsIntBound, toString, toTimeout
public static final Timeout DISABLED
MILLISECONDS
.public static Timeout defaultsToDisabled(Timeout timeout)
timeout
- may be null
timeValue
or DISABLED
public boolean isDisabled()
public boolean isEnabled()
public static Timeout of(long duration, TimeUnit timeUnit)
duration
- the time duration in the given timeUnit
.timeUnit
- the time unit for the given duration.public static Timeout ofDays(long days)
days
- the duration in days and the given timeUnit
.public static Timeout ofHours(long hours)
hours
- the duration in hours and the given timeUnit
.public static Timeout ofMicroseconds(long microseconds)
microseconds
- the duration in seconds and the given timeUnit
.public static Timeout ofMilliseconds(long milliseconds)
milliseconds
- the duration in milliseconds and the given timeUnit
.public static Timeout ofMinutes(long minutes)
minutes
- the duration in minutes and the given timeUnit
.public static Timeout ofNanoseconds(long nanoseconds)
nanoseconds
- the duration in seconds and the given timeUnit
.public static Timeout ofSeconds(long seconds)
seconds
- the duration in seconds and the given timeUnit
.public static Timeout parse(String value) throws java.text.ParseException
<Integer><SPACE><TimeUnit>
, for example "1,200 MILLISECONDS"
value
- the TimeValue to parsejava.text.ParseException
- if the number cannot be parsed