Package ptolemy.actor

Interface ActorExecutionAspect

  • All Superinterfaces:
    Decorator, Nameable
    All Known Implementing Classes:
    AtomicExecutionAspect, CompositeExecutionAspect, DynamicCoreAssignmentScheduler, EDFScheduler, FCFSScheduler, FixedPriorityScheduler

    public interface ActorExecutionAspect
    extends Decorator
    An interface for objects that can intervene in the execution of actors. A director that executes actors decorated by a resource scheduler has to consult the resource scheduler before firing the actor. If the resource scheduler returns that there are not enough resources available to fire the actor, the firing must be postponed.

    For example, a resource scheduler could represent a CPU and actors scheduled on a CPU have execution times. The resource scheduler takes care of scheduling the actors according to a given scheduling strategy and keeping track of the remaining execution times.

    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Patricia Derler, Edward A. Lee
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Method Detail

      • addExecutingListener

        void addExecutingListener​(ExecutionAspectListener listener)
                           throws IllegalActionException
        Add schedule listener. If necessary, initialize list of actors scheduled by this resource scheduler.
        Parameters:
        listener - The listener to be added.
        Throws:
        IllegalActionException - If an error occurs in the initialization of actors scheduled by this resource scheduler.
      • initializeDecoratedActors

        void initializeDecoratedActors()
                                throws IllegalActionException
        Iterate through all entities deeply contained by the container, record for each that it is not executing.
        Throws:
        IllegalActionException - If the decorator parameters cannot be read.
      • getExecutionTime

        double getExecutionTime​(NamedObj actor)
                         throws IllegalActionException
        Get the execution time of an actor. If the actor does not have an attribute specifying the execution time, return the minimum execution time.
        Parameters:
        actor - The named object.
        Returns:
        The execution time.
        Throws:
        IllegalActionException - Thrown in attribute or token cannot be read.
      • isWaitingForResource

        boolean isWaitingForResource​(Actor actor)
        Return whether an actor is currently waiting for a resource.
        Parameters:
        actor - The actor that might be waiting for a resource.
        Returns:
        True if the actor is waiting for a resource.
      • lastScheduledActorFinished

        boolean lastScheduledActorFinished()
        Check whether last actor that was scheduled on this resource scheduler finished execution.
        Returns:
        True if last actor that requested to be scheduled finished.
      • notifyExecutionListeners

        void notifyExecutionListeners​(NamedObj entity,
                                      java.lang.Double time,
                                      ExecutionAspectListener.ExecutionEventType eventType)
        Notify execution listeners about rescheduling events.
        Parameters:
        entity - Entity that is being scheduled.
        time - Time when entity is being scheduled.
        eventType - Type of event.
      • schedule

        Time schedule​(Time environmentTime)
               throws IllegalActionException
        Perform rescheduling actions when no new actor requests to be scheduled.
        Parameters:
        environmentTime - The outside time.
        Returns:
        Relative time when this Scheduler has to be executed again to perform rescheduling actions.
        Throws:
        IllegalActionException - Thrown in subclasses.
      • schedule

        Time schedule​(NamedObj actor,
                      Time environmentTime,
                      Time deadline,
                      Time executionTime)
               throws IllegalActionException
        Schedule the actor. In this base class, do nothing. Derived classes should schedule the actor.
        Parameters:
        actor - The actor to be scheduled.
        environmentTime - The current platform time.
        deadline - The deadline timestamp of the event to be scheduled. This can be the same as the environmentTime.
        executionTime - The execution time of the actor.
        Returns:
        Relative time when this Scheduler has to be executed again to perform rescheduling actions. In this base class, null is returned.
        Throws:
        IllegalActionException - Thrown if actor parameters such as execution time or priority cannot be read.
      • removeExecutionListener

        void removeExecutionListener​(ExecutionAspectListener listener)
        Remove schedule listener.
        Parameters:
        listener - The listener to be removed.