CyclicBarrier Class Flashcards

1
Q

Constructor that creates a CyclicBarrier object with the number of threads waiting on it specified. Throws IllegalArgumentException if numThreads is negative or zero.

A

CyclicBarrier(int numThreads)

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

Same as CyclicBarrier(int numThreads), additionaly takes the thread to call when the barrier is reached.

A

CyclicBarrier(int parties, Runnable barrierAction)

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

Blocks until the specified number of threads have called await() on this barrier. The method returns the arrival index of this thread. Has an overloaded version that takes a time-out period as an additional option. It throws a TimeoutException if all other threads aren’t reached within the time-out period.

A

int await()

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

Returns true if the barrier is broken. A barrier is broken if at least one thread in that barrier was interrupted or timed-out, or if a barrier action failed throwing an exception.

A

boolean isBroken()

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

Resets the barrier to the initial state. If any threads are waiting on that barrier, they will throw the BrokenBarrier exception.

A

void reset()

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