Abort countDownLatch.await() after time out

后端 未结 1 494
野的像风
野的像风 2021-01-04 18:45

I am using an ExecutorService to implement a 3-thread pool, and CountDownLatch to monitor the completion of all threads, for further processing.



        
相关标签:
1条回答
  • 2021-01-04 19:28

    Use the overloaded variant of await that accepts a timeout.

    countDownLatch.await(45, TimeUnit.SECONDS);
    
    0 讨论(0)
提交回复
热议问题