Class CountDown

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

public final class CountDown extends Object
A simple thread safe count-down class that in contrast to a CountDownLatch never blocks. This class is useful if a certain action has to wait for N concurrent tasks to return or a timeout to occur in order to proceed.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CountDown(int count)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Decrements the count-down and returns true iff this call reached zero otherwise false
    boolean
    Fast forwards the count-down to zero and returns true iff the count down reached zero with this fast forward call otherwise false
    boolean
    Returns true iff the count-down 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-down and returns true iff this call reached zero otherwise false
    • fastForward

      public boolean fastForward()
      Fast forwards the count-down to zero and returns true iff the count down reached zero with this fast forward call otherwise false
    • isCountedDown

      public boolean isCountedDown()
      Returns true iff the count-down has reached zero. Otherwise false