Interface DistributedActor

  • All Known Subinterfaces:
    RemoteDistributedActor
    All Known Implementing Classes:
    DistributedActorWrapper

    public interface DistributedActor
    An DistributedActor is a distributed executable entity. This interface defines the common functionality in DistributedActorWrapper and further implementations of distributed Actors. It defines the action methods, which determine how an distributed object can be invoked. It should be implemented by distributed actors.
    Since:
    Ptolemy II 5.1
    Version:
    $Id$
    Author:
    Daniel Lazaro Cuadrado (kapokasa@kom.aau.dk)
    See Also:
    DistributedActorWrapper, Actor, Executable
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (kapokasa)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void fire()
      Fire the distributed actor.
      java.net.InetAddress getAddress()
      Return the Internet Address where the distributed actor is executing.
      void initialize()
      Begin execution of the actor.
      int iterate​(int count)
      Invoke a specified number of iterations of the actor.
      boolean loadMoML​(java.lang.String moml)
      Load a moml representation of an actor.
      boolean postfire()
      This method should be invoked once per iteration, after the last invocation of fire() in that iteration.
      boolean prefire()
      This method should be invoked once per iteration, before the first invocation of fire() in that iteration.
      void preinitialize()
      This method should be invoked exactly once per execution of a model, before any of these other methods are invoked.
      void put​(java.util.HashMap data)
      Puts copies of the token received into the Receivers included in the IDlist.
      void setConnections​(java.util.HashMap connections)
      Set the "virtual connections" concerning the wrapped actor.
      void setPortTypes​(java.util.HashMap portTypes)
      Set the port types of the wrapped actor.
      void stop()
      Request that execution of the wrapped actor to stop as soon as possible.
      void stopFire()
      Request that execution of the current iteration of the wrapped actor complete.
      void terminate()
      Terminate any currently executing model with extreme prejudice.
      void wrapup()
      This method is invoked exactly once per execution of an application.
    • Method Detail

      • fire

        void fire()
           throws java.rmi.RemoteException
        Fire the distributed actor.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • getAddress

        java.net.InetAddress getAddress()
                                 throws java.rmi.RemoteException
        Return the Internet Address where the distributed actor is executing.
        Returns:
        InetAddress the Internet Address where the distributed actor is being executed.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • initialize

        void initialize()
                 throws java.rmi.RemoteException
        Begin execution of the actor.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • iterate

        int iterate​(int count)
             throws java.rmi.RemoteException
        Invoke a specified number of iterations of the actor.
        Parameters:
        count - The number of iterations to perform.
        Returns:
        NOT_READY, STOP_ITERATING, or COMPLETED.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • loadMoML

        boolean loadMoML​(java.lang.String moml)
                  throws java.rmi.RemoteException
        Load a moml representation of an actor.
        Parameters:
        moml - The moml code representing the actor to be loaded.
        Returns:
        True if the loading was successful.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • postfire

        boolean postfire()
                  throws java.rmi.RemoteException
        This method should be invoked once per iteration, after the last invocation of fire() in that iteration.
        Returns:
        True if the execution can continue.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • prefire

        boolean prefire()
                 throws java.rmi.RemoteException
        This method should be invoked once per iteration, before the first invocation of fire() in that iteration.
        Returns:
        True if the iteration can proceed.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • preinitialize

        void preinitialize()
                    throws java.rmi.RemoteException
        This method should be invoked exactly once per execution of a model, before any of these other methods are invoked.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • put

        void put​(java.util.HashMap data)
          throws java.rmi.RemoteException,
                 IllegalActionException
        Puts copies of the token received into the Receivers included in the IDlist. The data map contains a token and a list of IDs.
        Parameters:
        data - contains a token and a list of IDs.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
        IllegalActionException - If the transaction fails (e.g. the data type is incompatible).
      • setConnections

        void setConnections​(java.util.HashMap connections)
                     throws java.rmi.RemoteException
        Set the "virtual connections" concerning the wrapped actor. The connections HashMap contains a list of ports, and for each of them a mapping depending on the type of port. - If the port is an input: a list of receiver IDs that are contained by the port. i.e.: inputport, (IDa, ..., IDn) - If it is an output port: a mapping of services to lists of receivers. i.e.: outputport, (servicea, (IDi, ..., IDk), ... servicen, (IDn, ..., IDs)) For the input ports, a new relation of the type is created of the type DistributedTypepIORelation for every ID that is received. This is to force a Receiver to be created whenever createReceivers in the corresponding port is called. For the output ports, one only relation of the type DistributedTypepIORelation is created and the mapping of services to IDs is set into the relation. The relation sets that same structure in its internal DistributedReceiver that is in charge of token forwarding whenever send is called on the port.
        Parameters:
        connections - a mapping of ports, services and receiver IDs (see before).
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • setPortTypes

        void setPortTypes​(java.util.HashMap portTypes)
                   throws java.rmi.RemoteException
        Set the port types of the wrapped actor.
        Parameters:
        portTypes - is a Map of ports to port types.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • stop

        void stop()
           throws java.rmi.RemoteException
        Request that execution of the wrapped actor to stop as soon as possible.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • stopFire

        void stopFire()
               throws java.rmi.RemoteException
        Request that execution of the current iteration of the wrapped actor complete.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • terminate

        void terminate()
                throws java.rmi.RemoteException
        Terminate any currently executing model with extreme prejudice.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.
      • wrapup

        void wrapup()
             throws java.rmi.RemoteException
        This method is invoked exactly once per execution of an application.
        Throws:
        java.rmi.RemoteException - If a communication-related exception may occur during the execution of a remote method call.