The article directories
- One, foreword
- CountDownLatch overview
- Third, CountDownLatch source code analysis
- General example of CountDownLatch (methods involved: constructor, countDown, await)
- CountDownLatch concurrency example (methods involved: constructor, countDown, await)
- 6. Interview Goldfinger
-
- 6.1 CountDownLatch
- 6.2 Interview question: How to control the output of 10 threads from 1 to 10 in sequence?
- Seven, the end
One, foreword
CountDownLatch was introduced in Java 1.5 and exists in the java.util.cucurrent package, It was introduced along with CyclicBarrier, Semaphore, concurrentHashMap, and BlockingQueue.
CountDownLatch overview
The CountDownLatch class causes a thread to wait for other threads to finish executing.
CountDownLatch operates in three steps
- Constructor &