Make delicious recipes!

CountDownLatch

A CDL is a monitor object which is constructed using a count and any thread calling await() on this monitor waits till the count has reached zero due to repeated calls to countDown(). The count cannot be reset.


Example:


It’s an effective technique for master thread to wait for child threads to complete.

The master thread is put into waiting state in await() if count has not reached 0.

In countDown(), we notify the thread waiting in await() if count reaches 0.




Like us on Facebook to remain in touch
with the latest in technology and tutorials!


Got a thought to share or found a
bug in the code?
We'd love to hear from you:

Name:
Email: (Your email is not shared with anybody)
Comment:

Facebook comments:

Site Owner: Sachin Goyal