Class ContentionAlarm

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, BranchActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class ContentionAlarm
    extends CSPActor
    A ContentionAlarm is a CSP actor that creates an output only after timed deadlock has been reached by all other CSP actors in the containing composite actor. A ContentionAlarm has one input and one output port as well as three "informal" states. During the fire() method, the actor is enabled to cycle through each of the three states. In state one, the ContentionAlarm attempts to receive a token through its input port. Once a token has been received, the actor enters state two and calls the _waitForDeadlock() method that it inherits from CSPActor. This method means that the actor becomes time delayed and will not continue until all other actors in the composite actor are either blocked or time delayed. Once _waitForDeadlock() returns, the actor enters state three and sends a token through its output port. A useful application of ContentionAlarm is to notify other actors if there are multiple contenders for a given resource at a given time. Because of the semantics of _waitForDeadlock(), ContentionAlarm will not "wake up" until all contenders have attempted to access a particular resource. In addition to the time delay oriented semantics of ContentionAlarm, it can also notify an ExecEventListener as this actor jumps between its three states. Such notification is enabled by adding an ExecEventListener to this actor's listener list via the addListeners() method. Listeners can be removed via the removeListeners() method. ExecEventListeners are currently implemented to serve as conduits between Ptolemy II and the Diva graphical user interface.
    Since:
    Ptolemy II 0.3
    Version:
    $Id$
    Author:
    John S. Davis II
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (davisj)
    • Field Detail

      • input

        public TypedIOPort input
        The input port. The type of this port is BaseType.GENERAL.
      • output

        public TypedIOPort output
        The output port. The type of this port is BaseType.GENERAL.
    • Constructor Detail

      • ContentionAlarm

        public ContentionAlarm​(CompositeEntity cont,
                               java.lang.String name)
                        throws IllegalActionException,
                               NameDuplicationException
        Construct a ContentionAlarm actor with the specified container and name. Set the type of the input and output ports to BaseType.GENERAL.
        Parameters:
        cont - The container of this actor.
        name - The name of this actor.
        Throws:
        IllegalActionException - If the actor cannot be contained by the proposed container.
        NameDuplicationException - If the container already has an actor with this name.
    • Method Detail

      • fire

        public void fire()
                  throws IllegalActionException
        Execute this actor by cycling through its three states continually. Each state can potentially block due to the blocking semantics of CSP communication. Upon entry into each state, generate an ExecEvent with the corresponding state value.
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class AtomicActor<TypedIOPort>
        Throws:
        IllegalActionException - If communication through the input or output ports throws an IllegalActionException.