Class DDEThread

  • All Implemented Interfaces:
    java.lang.Runnable, Debuggable

    public class DDEThread
    extends ProcessThread
    A DDEThread controls an actor according to DDE semantics. The primary purpose of a DDEThread is to control the iteration methods of an executing actor and to maintain the actor's local notion of time according to DDE semantics. A DDEThread has two unique functionalities for accomplishing this goal. First a DDEThread instantiates a TimeKeeper object. A TimeKeeper manages a given actor's local notion of time according to DDE semantics. The second task of a DDEThread is to notify directly connected actors when the actor controlled by the thread is ending execution.
    Since:
    Ptolemy II 0.3
    Version:
    $Id$
    Author:
    John S. Davis II
    See Also:
    TimeKeeper
    Pt.AcceptedRating:
    Yellow (yuhong)
    Pt.ProposedRating:
    Yellow (davisj)
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Constructor Summary

      Constructors 
      Constructor Description
      DDEThread​(Actor actor, ProcessDirector director)
      Construct a thread to be used to execute the iteration methods of a DDEActor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      TimeKeeper getTimeKeeper()
      Return the time keeper that keeps time for the actor that this thread controls.
      void noticeOfTermination()
      Notify output-connected actors that the actor controlled by this thread is ending execution.
      void start()
      Start this thread and initialize the time keeper to a future time if specified in the director's initial time table.
      void wrapup()
      End the execution of the actor under the control of this thread.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DDEThread

        public DDEThread​(Actor actor,
                         ProcessDirector director)
                  throws IllegalActionException
        Construct a thread to be used to execute the iteration methods of a DDEActor. This increases the count of active actors in the director.
        Parameters:
        actor - The DDEActor that will be executed.
        director - The director of this actor.
        Throws:
        IllegalActionException - If thrown while create a new TimeKeeper.
    • Method Detail

      • getTimeKeeper

        public TimeKeeper getTimeKeeper()
        Return the time keeper that keeps time for the actor that this thread controls.
        Returns:
        The TimeKeeper of the actor that this thread controls.
      • noticeOfTermination

        public void noticeOfTermination()
        Notify output-connected actors that the actor controlled by this thread is ending execution. Output-connected actors are those that are connected to the actor controlled by this thread via output ports of this thread's actor. Send events with time stamps of PrioritizedTimedQueue.INACTIVE to these "downstream" actors.
        See Also:
        PrioritizedTimedQueue
      • start

        public void start()
        Start this thread and initialize the time keeper to a future time if specified in the director's initial time table. Use this method to facilitate any calls to DDEDirector.fireAt() that occur prior to the creation of this thread. If fireAt() was called for time 'T' with respect to the actor that this thread controls, then set the current time of this threads TimeKeeper to time 'T.'

        NOTE: This method assumes an implementation of fireAt() that would be more appropriately named continueAt().

        Overrides:
        start in class java.lang.Thread
      • wrapup

        public void wrapup()
                    throws IllegalActionException
        End the execution of the actor under the control of this thread. Notify all actors connected to this actor that this actor is preparing to cease execution.
        Overrides:
        wrapup in class ProcessThread
        Throws:
        IllegalActionException - If an error occurs while ending execution of the actor under the control of this thread.