Java Utililty Methods Sleep

List of utility methods to do Sleep

Description

The list of methods to do Sleep are organized into topic(s).

Method

voidsleep(int millis)
sleeps without interruption exception
long start = System.currentTimeMillis();
while (true) {
    long toWait = millis + start - System.currentTimeMillis();
    if (toWait < 0)
        return;
    try {
        Thread.sleep(toWait);
        return;
...
voidsleep(int millis, int micros)
sleep
try {
    if (micros <= 0) {
        Thread.sleep(millis);
    } else {
        Thread.sleep(millis, micros * 1000);
} catch (InterruptedException e) {
voidsleep(int milliseconds)
sleep
try {
    Thread.sleep(milliseconds);
} catch (InterruptedException e) {
voidsleep(int milliseconds, boolean isRecordMode)
Wrapper on the Thread.sleep, in case of record mode will not sleep, otherwise sleep.
if (isRecordMode) {
    try {
        Thread.sleep(milliseconds);
    } catch (InterruptedException e) {
        e.printStackTrace();
voidsleep(int minwait, int maxwait)
sleep
try {
    Thread.sleep(minwait + (int) (Math.random() * (maxwait - minwait)));
} catch (InterruptedException e) {
booleansleep(int ms)
sleep
try {
    Thread.sleep(ms);
} catch (InterruptedException e) {
    e.printStackTrace();
    return false;
return true;
voidsleep(int ms)
Sleep for ms.
if (ms > 0) {
    try {
        Thread.sleep(ms);
    } catch (InterruptedException e) {
voidsleep(int retryInterval)
Will enforce to sleep the thread for the provided time.
try {
    Thread.sleep(retryInterval);
} catch (InterruptedException ignore) {
    Thread.currentThread().interrupt();
voidsleep(int sec)
sleep
Thread.sleep(sec * UNIT_TIME);
voidsleep(int seconds)
sleep
try {
    Thread.sleep(seconds * 1000);
} catch (InterruptedException e) {