Java Utililty Methods Sleep for Second

List of utility methods to do Sleep for Second

Description

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

Method

voidpauseSeconds(long pauseSeconds)
pause Seconds
System.out.format("INFO:Utils::pauseSeconds: %d ...", pauseSeconds);
try {
    Thread.sleep(pauseSeconds * 1000);
} catch (InterruptedException e) {
System.out.format("consumed\n");
voidsleepForSeconds(long seconds)
sleep For Seconds
sleepForMillis(seconds * 1000);
voidsleepSecond(double second)
sleep Second
try {
    Thread.sleep((int) (1000 * second));
} catch (InterruptedException e) {
longsleepSeconds(double secs)
Sleeps the number of seconds.
long start = System.currentTimeMillis();
try {
    Thread.sleep((long) (1000 * secs));
} catch (InterruptedException e) {
    throw new IllegalStateException("Sleep was interrupted.", e);
long end = System.currentTimeMillis();
return end - start;
...
voidsleepSeconds(long seconds)

Sleeps for the specified time--in seconds.

try {
    Thread.sleep(seconds * 1000);
} catch (Exception e) {
voidsleepSeconds(long seconds)
sleep Seconds
sleepMillis(ONE_SECOND * seconds);
voidsleepThreadForOneToSuppliedSecond(Thread t, int seconds)
Sleep a thread for a number of seconds.
t.sleep(((int) (Math.random() * seconds) + 1) * 1000);
booleantrySleepSeconds(int seconds)
try Sleep Seconds
return trySleepMillis(seconds * 1000);
voidwaitForASecond()
wait For A Second
try {
    Thread.sleep(1000);
} catch (Exception ex) {
voidwaitForSeconds(int timeoutInSeconds)
wait For Seconds
try {
    Thread.sleep(timeoutInSeconds * 1000);
} catch (InterruptedException e) {
    e.printStackTrace();