Java TimeUnit Usage sleep(long durationMillis)

Here you can find the source of sleep(long durationMillis)

Description

sleep

License

Apache License

Declaration

public static void sleep(long durationMillis) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.concurrent.TimeUnit;

public class Main {

    public static void sleep(long durationMillis) {
        try {//from ww w  . j  a  va 2 s.  com
            Thread.sleep(durationMillis);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }

    public static void sleep(long duration, TimeUnit unit) {
        try {
            Thread.sleep(unit.toMillis(duration));
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }
}

Related

  1. secondsToMillis(int seconds)
  2. secondsToYearsDaysHoursMinutesSeconds(double seconds)
  3. selectDurationUnitForDisplay(long durationInNanos)
  4. sleep()
  5. sleep(int millis)
  6. sleep(long millis)
  7. sleep(long milliseconds)
  8. sleepForSeconds(int seconds)
  9. sleepMilliseconds(long milliseconds)