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

voidsleepForever()
A really bad way to keep a thread waiting.
while (true) {
    Thread.sleep(10000);
    Thread.yield();
voidsleepForever()
sleep Forever
sleep(Long.MAX_VALUE);
voidsleepForever()
sleep Forever
while (true) {
    try {
        Thread.sleep(Long.MAX_VALUE);
    } catch (InterruptedException e) {
voidsleepForIOCatchup()
sleep For IO Catchup
System.out.println("Waiting 10 seconds for I/O to catch up and properly close async appenders.");
try {
    Thread.sleep(10000);
} catch (InterruptedException ie) {
    System.err.println("Interrupted while waiting for I/O to catch up.");
voidsleepForReal(long time)
sleep For Real
long end = System.currentTimeMillis() + time;
while (true) {
    long now = System.currentTimeMillis();
    if (now >= end)
        return;
    Thread.sleep(end - now);
voidsleepForSecs(double numSecs)
sleep For Secs
try {
    Thread.sleep((long) (numSecs * 1000));
} catch (InterruptedException e) {
voidsleepForSomeTime(long milliseconds)
sleep For Some Time
try {
    Thread.sleep(milliseconds);
} catch (InterruptedException ignore) {
voidsleepForTimestamp()
sleep For Timestamp
if (!ourIsSleepForTimeStamp) {
    return;
long time = System.currentTimeMillis();
time = 1100 - (time - (time / 1000) * 1000);
try {
    Thread.sleep(time);
} catch (InterruptedException e) {
...
voidsleepIgnoreInterupt(long millis)
sleep Ignore Interupt
try {
    Thread.sleep(millis);
} catch (InterruptedException e) {
voidsleepInterruptible(long timeMillis)
sleep Interruptible
try {
    Thread.sleep(timeMillis);
} catch (InterruptedException e) {