Java Sleep sleep(long millis)

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

Description

sleep

License

Open Source License

Declaration

public static void sleep(long millis) 

Method Source Code

//package com.java2s;
/*/*from w  w w  .ja v a2  s  .c  o  m*/
 * Copyright (c) 2014 aleon GmbH.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Markus Rathgeb - initial API and implementation and/or initial documentation
 */

public class Main {
    public static void sleep(long millis) {
        long start;
        long end;
        long remaining = millis;
        do {
            start = System.nanoTime();
            try {
                Thread.sleep(remaining);
                remaining = 0;
            } catch (InterruptedException ex) {
                end = System.nanoTime();
                remaining -= (end - start) / 1000000;
            }
        } while (remaining > 0);
    }
}

Related

  1. sleep(long millions)
  2. sleep(long millis)
  3. sleep(long millis)
  4. sleep(Long millis)
  5. sleep(long millis)
  6. sleep(long millis)
  7. sleep(long millis)
  8. sleep(long millis)
  9. sleep(long millis)