Java Utililty Methods Thread Pause

List of utility methods to do Thread Pause

Description

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

Method

voidpause(int ms)
Pause du thread courant
try {
    Thread.currentThread().sleep(ms);
} catch (Exception e) {
voidpause(int secs)
pause
milliPause(secs * 1000);
voidpause(long low, long high)
pause
try {
    long t = (long) (Math.random() * low) + (high - low);
    Thread.sleep(t);
} catch (InterruptedException ex) {
    ex.printStackTrace();
voidpause(long milli)
pause
pauseWait(milli);
voidpause(long millis)
Waits for some time, handling Interrupted Exceptions.
try {
    Thread.sleep(millis);
} catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    throw new IllegalStateException("InterrupedException while pausing", e);
voidpause(long milliseconds)
Pauses the program for the specified number of milliseconds.
if (milliseconds == 0)
    return;
synchronized (Thread.currentThread()) {
    try {
        Thread.currentThread().wait(milliseconds);
    } catch (InterruptedException e) {
voidpause(long nbMilliseconds)
pause
try {
    System.out.println("Pause for " + nbMilliseconds + "ms.");
    Thread.sleep(nbMilliseconds);
} catch (InterruptedException e) {
    throw new IllegalStateException(e);
voidpause(long pause)
pause
try {
    Thread.sleep(pause);
} catch (InterruptedException e) {
    e.printStackTrace();
voidpause(long t)
To Pause the thread
try {
    Thread.sleep(t);
} catch (InterruptedException e) {
    e.printStackTrace();
voidpauseForTime(String pauseTime)
pause For Time
System.out.println("pausing for : " + pauseTime + " seconds");
Thread.sleep(Integer.valueOf(pauseTime) * 1000);