public class Latch extends Object implements AutoCloseable
try (final Latch i = myLatch.open()) { .... }or it can be used without the "try" if you do not want it to be auto-closed, as in
myLatch.open(); .... myLatch.close();so that exceptions coming out of the
....
will not close the Latch.Modifier and Type | Field and Description |
---|---|
protected String |
name |
protected boolean |
state |
Modifier | Constructor and Description |
---|---|
protected |
Latch(String name)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the Latch, e.g., in a try statement.
|
static Latch |
factory(String name)
Create a latch that is closed.
|
String |
getName()
Get the name, for debugging.
|
boolean |
getState()
Get the state.
|
Latch |
open()
Open the Latch, e.g., in a try statement.
|
protected boolean state
protected final String name
protected Latch(String name)
public Latch open()
public void close()
close
in interface AutoCloseable
public boolean getState()
public String getName()