Abort countDownLatch.await() after time out Abort countDownLatch.await() after time out multithreading multithreading

Abort countDownLatch.await() after time out


Use the overloaded variant of await that accepts a timeout.

countDownLatch.await(45, TimeUnit.SECONDS);