Here you can find the source of sleep(final int millis)
Parameter | Description |
---|---|
millis | Number of milliseconds to sleep |
public static boolean sleep(final int millis)
//package com.java2s; //License from project: Open Source License public class Main { public static boolean sleep(final double millis) { return sleep((int) millis); }/*from www . jav a 2 s .co m*/ /** * Sleeps the current thread, useful to handle interrupted exceptions. * This method sets the interrupted flag on the current thread, per best practice: * - http://www.yegor256.com/2015/10/20/interrupted-exception.html * - http://stackoverflow.com/questions/3976344/handling-interruptedexception-in-java * * @param millis Number of milliseconds to sleep * @return False on InterruptedException, true otherwise (implying that we have slept for the desired time duration) */ public static boolean sleep(final int millis) { try { Thread.sleep(millis); return true; } catch (final InterruptedException e) { Thread.currentThread().interrupt(); return false; } } }