The first one. Thread.join can only partially implement the function of CountDownLatch. Just look at the java doc of CountDownLatch. Not much to say
The second one. Thread.join uses the Object.wait/notify mechanism. java.lang.Thread.join(long millis) java doc writes:
This implementation uses a loop of this.wait calls conditioned on
this.isAlive. As a thread terminates the this.notifyAll method is
invoked. It is recommended that applications not use wait, notify,
or notifyAll on Thread instances.
Effective Java 2nd Edition said it very well. Compared with the functions provided by java.util.concurrent, wait/nofify is like concurrency assembly language. It is more difficult to use and easier to use. bug.
To summarize: After the concurrency package is available from java 1.5, the previous wait/notify/timer/synchorinized/synchronized container, etc., should be replaced by the java 1.5 concurrency package as much as possible.
The first one. Thread.join can only partially implement the function of CountDownLatch. Just look at the java doc of CountDownLatch. Not much to say
The second one. Thread.join uses the Object.wait/notify mechanism. java.lang.Thread.join(long millis) java doc writes:
Effective Java 2nd Edition said it very well. Compared with the functions provided by java.util.concurrent, wait/nofify is like concurrency assembly language. It is more difficult to use and easier to use. bug.
To summarize: After the concurrency package is available from java 1.5, the previous wait/notify/timer/synchorinized/synchronized container, etc., should be replaced by the java 1.5 concurrency package as much as possible.
http://stackoverflow.com/questions/21808814/whats-the-difference-between-cyclicbarrier-countdownlatch-and-join-in-java