CountDownLatch class Flashcards
Constructor that creates an instance of CountDownLatch with the number of times the countDown() method must be called before the threads waiting with await() can continue execution.
CountDownLatch(int count)
If the current count in CountDownLatch object is zero, it immediatly returns; otherwise the thread blocks until the countdown reaches zero. Can throw an InterruptedException.
void await()
Same as await(), but takes an additional timeout argument. If the thread return successfuly after the count reaches zero, this method returns true; if the thread returns because of a timeout, it returns false.
boolean await(long timeout, TimeUnit unit)
Reduces the number of counts by one in this CountDownLatch object. If the count reaches zero, all the waiting threads are released. If the current count is already zero, nothing happens.
void countDown()
Returns the pending counts in this CountDownLatch object.
long getCount()