I have two threads with countDownLatch
set to 1, so that, when the first threads finishes the second should starts. And what I want to do is, when the second finishes its task, I want to get the data computed from both threads to do some operations.
now my question is, is there any way to know if the CountDownLatch
object finished its task?
Update
is it safe to use
while (latch.getcountDown()==0) {
// do the calculations on the data processed by the two threads
}