public class CountLatch
extends java.lang.Object
CountDownLatch but with the ability
to also count up. This is useful to wait until a variable number of tasks
have completed. awaitZero() will block until the count reaches zero.| Constructor and Description |
|---|
CountLatch(int count) |
| Modifier and Type | Method and Description |
|---|---|
void |
awaitZero() |
boolean |
awaitZero(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
decrement() |
void |
increment() |
boolean |
isAtZero()
Gets whether this counting latch has arrived at zero
|
void |
resetAndInterrupt()
Resets the counter to zero.
|
java.lang.String |
toString() |
public void awaitZero()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic boolean awaitZero(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void increment()
public void decrement()
public void resetAndInterrupt()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isAtZero()