Java TimeUnit Calculate sleep(int duration, TimeUnit unit)

Here you can find the source of sleep(int duration, TimeUnit unit)

Description

sleep

License

Open Source License

Declaration

static void sleep(int duration, TimeUnit unit) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015-2016 Apcera Inc. All rights reserved. This program and the accompanying
 * materials are made available under the terms of the MIT License (MIT) which accompanies this
 * distribution, and is available at http://opensource.org/licenses/MIT
 *******************************************************************************/

import java.util.concurrent.TimeUnit;

public class Main {
    static void sleep(int timeout) {
        sleep(timeout, TimeUnit.MILLISECONDS);
    }//  ww w  .  j a  v  a  2 s  .  c  om

    static void sleep(int duration, TimeUnit unit) {
        try {
            unit.sleep(duration);
        } catch (InterruptedException e) {
            /* NOOP */
        }
    }
}

Related

  1. printTime(long time, TimeUnit unit)
  2. randomSleep(int duration, TimeUnit timeUnit)
  3. resetWithClockStep(long clockStep, TimeUnit clockStepUnit)
  4. run(final Runnable runnable, long timeout, TimeUnit unit)
  5. shortName(TimeUnit unit)
  6. sleep(long duration, TimeUnit timeUnit)
  7. sleep(long duration, TimeUnit timeUnit)
  8. sleep(long pTime, TimeUnit pTimeUnit)
  9. sleep(TimeUnit timeUnit, long duration)