Is there any way to explicitly release CountDownLatch
- means without do countDown()
.
E.g.: Let say I am waiting for 100 threads to do countDown()
, but if something fails, I would like to release this latch without anymore waiting. I was thinking to getCount()
on latch & then in for cycle do countDown()
, but its not optimal way.
Any suggestions / ideas ?
The CountDownLatch has an overloaded await() method which takes time and time unit as inputs and releases the lock once the given time elapses