Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

What is CountDownLatch? When we use CountDownLatch?'

Pragya Keshap answered on December 17, 2022 Popularity 8/10 Helpfulness 2/10

Contents


More Related Answers

  • countdown
  • add countdown time for the checkers game
  • add countdown time for the checkers game

  • What is CountDownLatch? When we use CountDownLatch?'

    0

    Simply put, a CountDownLatch has a counter field, which you can decrement as we require. We can then use it to block a calling thread until it's been counted down to zero.

    If we were doing some parallel processing, we could instantiate the CountDownLatch with the same value for the counter as a number of threads we want to work across. Then, we could just call countdown() after each thread finishes, guaranteeing that a dependent thread calling await() will block until the worker threads are finished. 

    https://www.baeldung.com/java-countdown-latch

    Popularity 8/10 Helpfulness 2/10 Language java
    Source: Grepper
    Tags: java when
    Link to this answer
    Share Copy Link
    Contributed on Feb 22 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10

    Closely Related Answers



    -1
    Popularity 8/10 Helpfulness 1/10 Language whatever
    Link to this answer
    Share Copy Link
    Contributed on Dec 17 2022
    Deepika Sahu
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.