Sleep and check until condition is true

后端 未结 7 2092
借酒劲吻你
借酒劲吻你 2020-12-16 11:39

Is there a library in Java that does the following? A thread should repeatedly sleep for x milliseconds until a condition becomes true or the max t

相关标签:
7条回答
  • 2020-12-16 12:12

    You should be using a Condition.

    If you would like to have a timeout in addition to the condition, see await(long time, TimeUnit unit)

    0 讨论(0)
提交回复
热议问题