A latch is a Java synchronizer that allows one or more threads to wait until a bunch of events in other threads has completed. It starts from a given counter (commonly representing the number of events that should be waited), and each event that completes is responsible for decrementing the counter. When the counter reaches zero all the waiting threads can pass through. This is the terminal state of a latch. A latch cannot be reset or reused, so the waited events can happen only once. The following diagram shows, in four steps, how a latch with three threads works:
In API terms, a latch is implemented using java.util.concurrent.CountDownLatch ...