synchronization aid that allows a set of threads to all wait for each
other to reach a common barrier point. CyclicBarriers are useful in
programs involving a fixed sized party of threads that must
occasionally wait for each other.
barrier is called cyclic
because it can be re-used after the waiting threads are released.
CyclicBarrier supports an optional Runnable command that is run once
per barrier point, after the last thread in the party arrives, but
before any threads are released. This barrier
useful for updating shared-state before any of the parties continue.
a Cyclic-Barrier (CB) is different from Count-Down-Latch (CDL) in 2
has a barrier-action thread to run when all threads reach waiting
can be reused after all threads have reached waiting state once.