public class ReusableLatch
extends java.lang.Object
| Constructor and Description |
|---|
ReusableLatch() |
ReusableLatch(boolean startReleased) |
| Modifier and Type | Method and Description |
|---|---|
void |
await()
Block until another thread calls release, or the thread is interrupted.
|
void |
await(long timeoutMillis)
Block until another thread calls release, or the thread is interrupted.
|
void |
awaitUninterruptibly()
Block until release is called by another thread.
|
boolean |
isReleased()
Returns whether or not release has been called and threads can call await without blocking.
|
void |
release()
Allow all waiting threads to go through, and all future threads to proceed without blocking.
|
void |
reset()
Resets the latch to an un-release state.
|
java.lang.String |
toString() |
public ReusableLatch()
public ReusableLatch(boolean startReleased)
public void await()
throws java.lang.InterruptedException
java.lang.InterruptedException - If the operation was interrupted while waiting.public void await(long timeoutMillis)
throws java.lang.InterruptedException,
java.util.concurrent.TimeoutException
timeoutMillis - Timeout, in milliseconds, to wait for the release.java.lang.InterruptedException - If the operation was interrupted while waiting.java.util.concurrent.TimeoutException - If the timeout expired prior to being able to await the release.public void awaitUninterruptibly()
public void release()
public boolean isReleased()
public void reset()
public java.lang.String toString()
toString in class java.lang.Object