Wherever possible, this implementation is semantically equivalent to {@link java.util.concurrent.CountDownLatch}, and adheres to as many of the same constraints as are reasonable to expect. Where this implementation differs, a notation will be made in the javadoc for that method.
Note that, unlike the concurrent version of this class, multiple uses of this class is allowed, so long as {@link #closeLatch()} is called between uses.
Unlike concurrent {@link java.util.concurrent.CountDownLatch} implementations, these implementations are sensitiveto node failure. In a concurrent world, if one thread fails, then the latch may not proceed, causing limited deadlocks, which may not be ideal, but are generally caused by manageable situations which can be accounted for. In the distributed environment, Node failures may occur at any time, for any number of reasons, some of which cannot be controlled or accounted for. In general, it is better, wherever possible, to allow latches to proceed even in the face of node failure scenarios.
To account for these node failure scenarios, once a party has counted down, then this latch will regard it as permanently counted down. In this sense, all latches on all nodes will regard this as counted down, even if the party which did the counting down subsequently fails.
Note, however, that if a node fails before it can count down, it will leave all parties waiting potentially indefinitely for the latch to proceed. Only after a node has counted down (in the ZooKeeper-server-ordering) will other parties ignore that failure. @author Scott Fines @version 1.0 @see java.util.concurrent.CountDownLatch
|
|
|
|
|
|