java.lang.Object
org.elasticsearch.common.util.concurrent.CountDown

public final class CountDown extends Object
A simple thread-safe count-down class that does not block, unlike a CountDownLatch. This class is useful if an action must wait for N concurrent tasks to succeed, or some other task to fail, in order to proceed. When called enough times, exactly one invocation of countDown() or fastForward() will return true.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CountDown(int count)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Decrements the count and returns true if and only if the count reached zero with this call.
    boolean
    Fast-forwards the count to zero and returns true if and only if the count reached zero with this call.
    boolean
    Returns true if and only if the count has reached zero.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CountDown

      public CountDown(int count)
  • Method Details

    • countDown

      public boolean countDown()
      Decrements the count and returns true if and only if the count reached zero with this call.
    • fastForward

      public boolean fastForward()
      Fast-forwards the count to zero and returns true if and only if the count reached zero with this call.
    • isCountedDown

      public boolean isCountedDown()
      Returns true if and only if the count has reached zero.