java 线程睡眠唤醒_Java睡眠线程

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

示例:Hibernate线程 (

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值