java 线程睡眠唤醒
To sleep a thread for a specified time, Java provides sleep method which is defined in Thread class. The sleep method is an overloaded method which are given below. It throws interrupted exception so make sure to provide proper handler.
为了使线程Hibernate指定的时间,Java提供了Thread类中定义的sleep方法。 睡眠方法是一种重载方法,如下所示。 它会引发中断的异常,因此请确保提供适当的处理程序。
It always pause the current thread execution. Any other thread can interrupt the current thread in sleep, in that case InterruptedException is thrown.
它总是暂停当前线程的执行。 任何其他线程都可以在睡眠中中断当前线程,在这种情况下会抛出InterruptedException。
句法 (Syntax)
sleep(long millis)throws InterruptedException
sleep(long millis, int nanos)throws InterruptedException