/**
* A synchronization aid that allows one or more threads to wait until
* a set of operations being performed in other threads completes.
* 一种允许一个或多个线程处于等待状态直到其他线程完成一系列操作的同步机制。

* <p>A {@code CountDownLatch} is initialized with a given <em>count</em>.
* The {@link #await await} methods block until the current count reaches
* zero due to invocations of the {@link #countDown} method, after which
* all waiting threads are released and any subsequent invocations of
* {@link #await await} return immediately. This is a one-shot phenomenon
* -- the count cannot be reset. If you need a version that resets the
* count, consider using a {@link CyclicBarrier}.
* CountDownLatch通过给定的数值count初始化。await方法将处于阻塞状态直到countDown方法被调用时当前count值达到0为止,
  在这之后所有处于waiting线程都被释放并且后续调用await方法都会立即返回。CountDownLatchcount是一次性的,即不能被重置。如果你需要一个可重置的count,考虑使用CyclicBarrier。

* <p>A {@code CountDownLatch} is a versatile synchronization tool
* and can be used for a number of purposes. A
* {@code CountDownLatch} initialized with a count of one serves as a
* simple on/off latch, or gate: all threads invoking {@link #await await}
* wait at the gate until it is opened by a thread invoking {@link
* #countDown}. A {@code CountDownLatch} initialized to <em>N</em>
* can be used to make one thread wait until <em>N</em> threads have
* completed some action, or some action has been completed N times.
* CountDownLatch是一种通用的、有多种用途的同步工具。一个用“1”初始化的CountDownLatch相当于一个简单的开关门,
版权声明:本文为VinnMerlin原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/VinnMerlin/p/11710863.html