|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ptolemy.kernel.util.NamedObj ptolemy.kernel.util.Attribute ptolemy.actor.Director ptolemy.actor.process.ProcessDirector ptolemy.actor.process.CompositeProcessDirector ptolemy.domains.rendezvous.kernel.RendezvousDirector
public class RendezvousDirector
This director executes actors in their own threads and provides a receiver that implements rendezvous communication. The threads are created in the initialize() method and started in the prefire() method. After the thread for an actor is started it is active until the thread finishes. While the thread is active, it can also be blocked. A thread is blocked if it is trying to communicate but the thread with which it is trying to communicate is not ready to do so yet. A deadlock occurs when all threads are blocked. If this director is used at the top level, the model stops executing when a deadlock occurs. This director is based on the CSPDirector by Neil Smyth, Mudit Goel, and John S. Davis II.
green (acataldo) |
green (acataldo) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
protected boolean |
_inWrapup
Set to true when the director enters the wrapup() method. |
private java.util.HashMap |
_resultMaps
The map that records the result maps for the threads. |
Fields inherited from class ptolemy.actor.process.ProcessDirector |
---|
_notDone, _stopFireRequested |
Fields inherited from class ptolemy.actor.Director |
---|
_actorsFinishedExecution, _currentTime, _finishRequested, _initializables, _stopRequested, timeResolution |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Fields inherited from interface ptolemy.actor.Executable |
---|
COMPLETED, NOT_READY, STOP_ITERATING |
Constructor Summary | |
---|---|
RendezvousDirector()
Construct a director in the default workspace with an empty string as its name. |
|
RendezvousDirector(CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name. |
|
RendezvousDirector(Workspace workspace)
Construct a director in the workspace with an empty name. |
Method Summary | |
---|---|
protected boolean |
_areAllThreadsStopped()
Return true if the count of active threads equals the number of stopped (paused) or blocked threads. |
protected boolean |
_areThreadsDeadlocked()
Return true if all active threads are blocked. |
protected java.util.Map |
_getResultMap(java.lang.Thread thread)
Return the map of results for the given thread. |
protected boolean |
_resolveInternalDeadlock()
If the model is deadlocked, report the deadlock if parameter "SuppressDeadlockReporting" is not set to boolean true, and return false. |
protected java.util.Map |
_setResultMap(java.lang.Thread thread,
java.util.Map map)
Set the map of results for the given thread. |
Receiver |
newReceiver()
Return a new instance of RendezvousReceiver compatible with this director. |
boolean |
postfire()
Return false if the model should not continue to execute. |
java.lang.String[] |
suggestedModalModelDirectors()
Return an array of suggested directors to be used with ModalModel. |
void |
wrapup()
Override the base class to set a flag indicating we are in the wrapup phase. |
Methods inherited from class ptolemy.actor.process.CompositeProcessDirector |
---|
_areActorsExternallyBlocked, _controllerBlocked, _controllerUnBlocked, _isInputControllerBlocked, _isOutputControllerBlocked, _resolveDeadlock, clone, createBranchController, getInputController, getOutputController, initialize, prefire, setModelTime, stopInputBranchController, stopOutputBranchController, threadBlocked, threadUnblocked |
Methods inherited from class ptolemy.actor.process.ProcessDirector |
---|
_getActiveThreadsCount, _getBlockedThreadsCount, _getStoppedThreadsCount, _newProcessThread, addThread, finish, fire, initialize, isStopFireRequested, isStopRequested, isThreadActive, preinitialize, removeThread, stop, stopFire, terminate, threadHasPaused, threadHasResumed, transferInputs, transferOutputs |
Methods inherited from class ptolemy.kernel.util.Attribute |
---|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean _inWrapup
private java.util.HashMap _resultMaps
Constructor Detail |
---|
public RendezvousDirector()
public RendezvousDirector(Workspace workspace)
workspace
- The workspace of this object.public RendezvousDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- Container of the director.name
- Name of this director.
IllegalActionException
- If the director is not
compatible with the specified container.
NameDuplicationException
- If the container not a
CompositeActor and the name collides with an entity in the container.Method Detail |
---|
public Receiver newReceiver()
newReceiver
in class CompositeProcessDirector
public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class ProcessDirector
IllegalActionException
- If thrown by the parent class.public java.lang.String[] suggestedModalModelDirectors()
suggestedModalModelDirectors
in class Director
Director.suggestedModalModelDirectors()
public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class CompositeProcessDirector
IllegalActionException
- If the parent class throws it.protected boolean _areAllThreadsStopped()
_areAllThreadsStopped
in class ProcessDirector
protected boolean _areThreadsDeadlocked()
_areThreadsDeadlocked
in class CompositeProcessDirector
protected java.util.Map _getResultMap(java.lang.Thread thread)
thread
- The thread.
_setResultMap(Thread, Map)
protected boolean _resolveInternalDeadlock() throws IllegalActionException
_resolveInternalDeadlock
in class CompositeProcessDirector
IllegalActionException
- If thrown while getting
the "SuppressDeadlockReporting" token.protected java.util.Map _setResultMap(java.lang.Thread thread, java.util.Map map)
thread
- The thread.map
- The result map to be associated with that thread.
_getResultMap(Thread)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |