public class Conditions
extends java.lang.Object
invalidate(String)
. Then launch B and register A with
waitFor(String, ThreadedTask, Object)
. In B when the condition is complete call validate(String)
.
It will launch A.Modifier and Type | Field and Description |
---|---|
private java.util.HashMap<java.lang.String,java.util.ArrayList<Pair<ThreadedTask,java.lang.Object>>> |
conditions
Conditions list
|
static Conditions |
CONDITIONS
Conditions singleton
|
private Mutex |
mutex
Mutex for synchronized
|
Modifier | Constructor and Description |
---|---|
private |
Conditions()
Create a new instance of Conditions
|
Modifier and Type | Method and Description |
---|---|
void |
invalidate(java.lang.String condition)
Invalidate a condition.
|
boolean |
isValid(java.lang.String condition)
Indicates if a condition is valid
|
<PARAMETER> |
validate(java.lang.String condition)
Validate a condition and launch all waiting threads
|
<PARAMETER> |
waitFor(java.lang.String condition,
ThreadedTask<PARAMETER,?,?> task,
PARAMETER parameter)
Register a thread to wait a condition to be valid before launch.
|
public static final Conditions CONDITIONS
private final java.util.HashMap<java.lang.String,java.util.ArrayList<Pair<ThreadedTask,java.lang.Object>>> conditions
private final Mutex mutex
public void invalidate(java.lang.String condition)
validate(String)
condition
- Condition to invalidatepublic boolean isValid(java.lang.String condition)
condition
- Condition to testpublic <PARAMETER> void validate(java.lang.String condition)
PARAMETER
- Thread parameter typecondition
- Condition to validatepublic <PARAMETER> void waitFor(java.lang.String condition, ThreadedTask<PARAMETER,?,?> task, PARAMETER parameter)
PARAMETER
- Thread parameter typecondition
- Condition to waittask
- Thread to launchparameter
- Thread parameter