1.

What Is Cyclicbarrier In Java Concurrency?

Answer»

CyclicBarrier is useful in scenarios where you want set of threads to wait for each other to REACH a common barrier POINT. When each thread reaches the barrier (common point) you NEED to call await() method on the CyclicBarrier object. This will SUSPEND the thread until all the thread also call the await() method on the same CyclicBarrier object.

Once all the specified threads have called await() method that will trip the barrier and all threads can RESUME operation.

The barrier is called cyclic because it can be re-used after the waiting threads are released.

CyclicBarrier is useful in scenarios where you want set of threads to wait for each other to reach a common barrier point. When each thread reaches the barrier (common point) you need to call await() method on the CyclicBarrier object. This will suspend the thread until all the thread also call the await() method on the same CyclicBarrier object.

Once all the specified threads have called await() method that will trip the barrier and all threads can resume operation.

The barrier is called cyclic because it can be re-used after the waiting threads are released.



Discussion

No Comment Found