Java Sleep sleep(long millis)

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

Description

Sleep without throwing an exception.

License

LGPL

Parameter

Parameter Description
millis time in milliseconds

Return

true if not interrupted

Declaration

public static boolean sleep(long millis) 

Method Source Code

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

public class Main {
    /**/*from  ww  w . j  a v  a 2s  .c  o  m*/
     * Sleep without throwing an exception.
     * 
     * @param millis time in milliseconds
     * @return true if not interrupted
     */
    public static boolean sleep(long millis) {
        try {
            Thread.sleep(millis);
            return true;
        } catch (InterruptedException e) {
            return false;
        }
    }
}

Related

  1. sleep(long millis)
  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)