Class CountDown
java.lang.Object
org.elasticsearch.common.util.concurrent.CountDown
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanDecrements the count-down and returnstrueiff this call reached zero otherwisefalsebooleanFast forwards the count-down to zero and returnstrueiff the count down reached zero with this fast forward call otherwisefalsebooleanReturnstrueiff the count-down has reached zero.
-
Constructor Details
-
CountDown
public CountDown(int count)
-
-
Method Details
-
countDown
public boolean countDown()Decrements the count-down and returnstrueiff this call reached zero otherwisefalse -
fastForward
public boolean fastForward()Fast forwards the count-down to zero and returnstrueiff the count down reached zero with this fast forward call otherwisefalse -
isCountedDown
public boolean isCountedDown()Returnstrueiff the count-down has reached zero. Otherwisefalse
-