* on the actor.
*/
public void run() {
_debug("-- Starting thread.");
Workspace workspace = _director.workspace();
boolean iterate = true;
Throwable thrownWhenIterate = null;
Throwable thrownWhenWrapup = null;
try {
// Initialize the actor.
_actor.initialize();
// While postfire() returns true and stop() is not called.
while (iterate) {
// NOTE: Possible race condition... actor.stop()
// might be called before we get to this.
// This will cause postfire() on the actor
// to return false, which will stop its execution.
if (_director.isStopFireRequested()) {
// And wait until the flag has been cleared.
_debug("-- Thread pause requested. Get lock on director.");
synchronized (_director) {
// Tell the director we're stopped (necessary
// for deadlock detection).
_director.threadHasPaused(this);
while (_director.isStopFireRequested()) {
// If a stop has been requested, in addition
// to a stopFire, then stop execution
// altogether and skip to wrapup().
if (_director.isStopRequested()) {
_debug("-- Thread stop requested, "
+ "so cancel iteration.");
break;
}
_debug("-- Thread waiting for "
+ "canceled pause request.");
try {
workspace.wait(_director);
} catch (InterruptedException ex) {
_debug("-- Thread interrupted, "
+ "so cancel iteration.");
break;
}