|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.distributed.client.ThreadSynchronizer
public class ThreadSynchronizer
Synchronizes the access to the commandsMap. In order to allow parallel execution of commands, the ClientThreads that manage remote actors locally in the DistributedSDFDirector have to be able to access the commands without blocking the main execution Thread in a synchronized manner. Commands are represented by integers. It provides mechanisms to issue sets of commands and synchronize the access to those commands by the client Threads. It is assumed that no new set of commands is issued before the previous set of commands has been processed. Every ClientThread is responsible to set itself as ready after performing a command.
ClientThread
Red (cxh) |
Red (kapokasa) |
Field Summary | |
---|---|
private java.util.HashMap |
commandsMap
The Map containing the commands to be executed. |
private java.util.HashMap |
notReadyMap
The Map containing the Threads that are not ready. |
private boolean |
VERBOSE
It states whether debugging messages should be printed. |
Constructor Summary | |
---|---|
ThreadSynchronizer()
Construct a ThreadSynchronizer. |
Method Summary | |
---|---|
void |
commandsProcessed()
Waits until readyMap is empty. |
int |
getCommand(java.lang.Object key)
Synchronizes access to the commands by the ClientThreads. |
void |
setCommands(java.util.HashMap commands)
Issues a new set of commands. |
void |
setReady(java.lang.Object key)
Removes a given key from the readyMap. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean VERBOSE
private java.util.HashMap commandsMap
private java.util.HashMap notReadyMap
Constructor Detail |
---|
public ThreadSynchronizer()
Method Detail |
---|
public void commandsProcessed()
public int getCommand(java.lang.Object key)
key
- An object that used as the key in the commands map.
public void setCommands(java.util.HashMap commands)
commands
- HashMap representing the commands.public void setReady(java.lang.Object key)
key
- The key to be removed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |