CountDownLatch class Flashcards

1
Q

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.

A

CountDownLatch(int count)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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.

A

void await()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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.

A

boolean await(long timeout, TimeUnit unit)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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.

A

void countDown()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Returns the pending counts in this CountDownLatch object.

A

long getCount()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly