java.lang.Object
org.elasticsearch.common.util.concurrent.CountDown
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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Decrements the count and returnstrue
if and only if the count reached zero with this call.boolean
Fast-forwards the count to zero and returnstrue
if and only if the count reached zero with this call.boolean
Returnstrue
if and only if the count has reached zero.
-
Constructor Details
-
CountDown
public CountDown(int count)
-
-
Method Details
-
countDown
public boolean countDown()Decrements the count and returnstrue
if and only if the count reached zero with this call. -
fastForward
public boolean fastForward()Fast-forwards the count to zero and returnstrue
if and only if the count reached zero with this call. -
isCountedDown
public boolean isCountedDown()Returnstrue
if and only if the count has reached zero.
-