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

voidsleepQuietly(long ms)
sleep Quietly
try {
    sleep(ms);
} catch (InterruptedException ignored) {
voidsleepQuite(long millis)
Sleep quite
try {
    Thread.sleep(millis);
} catch (InterruptedException e) {
voidsleepRandMs(int ms)
sleep Rand Ms
sleepMs((long) (Math.random() * ms));
voidsleepRandom(long floor, long ceiling)
Sleeps between floor and ceiling milliseconds, chosen randomly
if (ceiling - floor <= 0) {
    return;
long diff = ceiling - floor;
long r = (int) ((Math.random() * 100000) % diff) + floor;
sleep(r);
voidsleepRandom(long timeout)
Sleeps between 1 and timeout milliseconds, chosen randomly.
if (Thread.interrupted())
    throw new InterruptedException(); 
if (timeout <= 0) {
    return;
long r = (int) ((Math.random() * 100000) % timeout) + 1;
sleep(r);
voidsleepSafely(final long millis)
Causes calling thread to sleep and ignores thrown InterruptedException.
try {
    Thread.sleep(millis);
} catch (final InterruptedException e) {
voidsleepSilently(int millis)
Attempts to sleep for the specified amount of milliseconds.
try {
    Thread.sleep(millis);
} catch (InterruptedException e) {
voidsleepSilently(int millis)
sleep Silently
try {
    Thread.sleep(millis);
} catch (InterruptedException e) {
voidsleepThread(long millSecd)
sleep Thread
try {
    Thread.sleep(millSecd);
} catch (InterruptedException e) {
    e.printStackTrace();
voidsleepThread(long sleeptime)
Puts the current thread to sleep for the desired number of ms, suppressing any exceptions.
try {
    Thread.sleep(sleeptime);
} catch (InterruptedException ie) {