Java Sleep sleep(long interval)

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

Description

Sleeps the given interval of time given in milliseconds.

License

Open Source License

Parameter

Parameter Description
interval time to sleep in milliseconds

Return

true if was not interrupted

Declaration

public static boolean sleep(long interval) 

Method Source Code

//package com.java2s;
/*// w w w .j  av  a  2  s  .  co  m
 *   Copyright (c) 2006-2010 Marvisan Pty. Ltd. All rights reserved.6
 *               Use is subject to license terms.
 */

public class Main {
    /**
     * Sleeps the given interval of time given in milliseconds.
     * @param interval time to sleep in milliseconds
     * @return true if was not interrupted
     */
    public static boolean sleep(long interval) {
        boolean result = true;
        try {
            Thread.sleep(interval);
        } catch (InterruptedException ex) {
            result = false;
        }

        return result;
    }
}

Related

  1. sleep(int sleepInSeconds)
  2. sleep(int toSleep)
  3. sleep(Integer seconds)
  4. sleep(Integer threadWaitInMs)
  5. sleep(long duration)
  6. sleep(long l)
  7. sleep(long milli)
  8. sleep(long millions)
  9. sleep(long millis)