Java - alternative to thread.sleep

前端 未结 8 671
礼貌的吻别
礼貌的吻别 2020-11-30 10:00

I have a requirement to pause a while loop for a specific number of milliseconds. I have tried using Thread.sleep(duration) but it is not accurate, especially in a looping s

8条回答
  •  一生所求
    2020-11-30 10:18

    Try a ScheduledThreadPoolExecutor. It's supposed to give more reliable timing results.

提交回复
热议问题