See many people on the net the difference between Countdownlatch and Cyclicbarrier is simple to understand that Countdownlatch is a one-time, and cyclicbarrier can continue to use after calling reset. Well, if it's just that simple, I think Cyclicbarrier is simply named Resetablecountdownlatch , which is obviously not.
My understanding is to look at these two classes from their design goals. The description inside the Javadoc is like this.
COUNTDOWNLATCH:A synchronization aid that allows one or more threads to wait until A set of operations being performed in Other threads completes.
CYCLICBARRIER:A synchronization aid that allows a set of threads to all wait for each other to reach A common barrier PO Int.
Maybe my english is not good enough, I feel that it is not easy to understand their differences accurately from this javadoc.
My understanding is that
Countdownlatch: One thread (or more) waits for another n thread to complete something before it can be executed. Cyclicbarrier: N threads wait for each other, and all threads must wait before any one thread finishes.
This should be clear, for Countdownlatch, the focus is the "one thread", it is waiting, and the other n of the thread after the "something" can continue to wait, can be terminated. For Cyclicbarrier, the point is that n threads , either one of them is not finished, and all the threads must wait.
Countdownlatch is the counter, the thread completes one to remember one, just like a count off, just is descending.
And cyclicbarrier more like a sluice, the thread executes like the water, at the gate will be blocked, until the water is full (thread-to-Qi), only to begin to vent the flow.
http://blog.csdn.net/kjfcpua/article/details/7300286
The difference between Countdownlatch and Cyclicbarrier (RPM)