public class WaitingManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static WaitingManager |
MANAGER
Waiter manager singleton instance
|
private static Mutex |
MUTEX
For synchronize
|
private java.util.HashMap<java.lang.String,Queue<Pair<ThreadedTask<?,?,?>,?>>> |
waiters
Threaded task that are waiting
|
Modifier | Constructor and Description |
---|---|
private |
WaitingManager()
Create a new instance of WaitingManager
|
Modifier and Type | Method and Description |
---|---|
<PARAMETER,RESULT,PROGRESS> |
register(ThreadedTask<PARAMETER,RESULT,PROGRESS> threadedTask,
PARAMETER parameter,
java.lang.String waitingFor)
Register a task to be play on specific event
|
<PARAMETER,RESULT,PROGRESS> |
wakeupAll(java.lang.String waitingFor)
Wake up all task that are waiting for a specific event
|
<PARAMETER,RESULT,PROGRESS> |
wakeupNext(java.lang.String waitingFor)
Wake up the head of waiting queue for an event
|
private static final Mutex MUTEX
public static final WaitingManager MANAGER
private final java.util.HashMap<java.lang.String,Queue<Pair<ThreadedTask<?,?,?>,?>>> waiters
public <PARAMETER,RESULT,PROGRESS> void register(ThreadedTask<PARAMETER,RESULT,PROGRESS> threadedTask, PARAMETER parameter, java.lang.String waitingFor)
PARAMETER
- Task parameter typeRESULT
- Task result typePROGRESS
- Task progress typethreadedTask
- Task that waitparameter
- Parameter to give to task when its time to play comeswaitingFor
- Waiting eventpublic <PARAMETER,RESULT,PROGRESS> void wakeupAll(java.lang.String waitingFor)
PARAMETER
- Task parameter typeRESULT
- Task result typePROGRESS
- Task progress typewaitingFor
- Event to wake uppublic <PARAMETER,RESULT,PROGRESS> void wakeupNext(java.lang.String waitingFor)
PARAMETER
- Task parameter typeRESULT
- Task result typePROGRESS
- Task progress typewaitingFor
- Event to wake up