public class TimeUtil extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SLEEP_TIME
The default timeout used in
sleep(int, long) . |
Constructor and Description |
---|
TimeUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
checkForTimeout(int timeout,
long waitingSince)
Throws a InterruptedException if a timeout occurred.
|
protected static long |
getTimeToSleep(long toSleep,
int timeout,
long waitingSince) |
static void |
sleep(int timeout,
long waitingSince)
Sleeps the
default time or either the thread
was interrupted or a timeout occurred. |
static void |
sleep(long toSleep,
int timeout,
long waitingSince)
Sleeps the given amount of time or either the thread was interrupted or a
timeout occurred.
|
public static final int DEFAULT_SLEEP_TIME
sleep(int, long)
.public static void sleep(int timeout, long waitingSince) throws InterruptedException
default
time or either the thread
was interrupted or a timeout occurred.timeout
- the ms to wait at all before a timeout occurs, where
0
means infinity. Must be >= 0.waitingSince
- the timestamp since when the blocking method is waiting in ms.InterruptedException
- if the sleep() has been interrupted or a timeout occurred.public static void sleep(long toSleep, int timeout, long waitingSince) throws InterruptedException
toSleep
- the time to sleep in ms.timeout
- the ms to wait at all before a timeout occurs, where
0
means infinity. Must be >= 0.waitingSince
- the timestamp since when the blocking method is waiting in ms.InterruptedException
- if the sleep() has been interrupted or a timeout occurred.protected static long getTimeToSleep(long toSleep, int timeout, long waitingSince)
public static void checkForTimeout(int timeout, long waitingSince) throws InterruptedException
timeout
- the ms to wait at all before a timeout occurs.waitingSince
- the timestamp since when the blocking method is waiting in ms.InterruptedException
- if a timeout occurred.Copyright © 2014. All Rights Reserved.