Class AMQPAgent

    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        serialVersionUID
        See Also:
        Constant Field Values
      • logger

        private static final Logger logger
        logger
      • lockers

        private static Map<Long,​Long> lockers
        contains the lock Object to notify.
      • responses

        private static Map<Long,​Object> responses
        contains the async response.
    • Constructor Detail

      • AMQPAgent

        public AMQPAgent()
        Empty constructor for newInstance().
    • Method Detail

      • agentInitialize

        protected void agentInitialize​(boolean firstTime)
                                throws Exception
        Gives this agent an opportunity to initialize after having been deployed, and each time it is loaded into memory.
        Overrides:
        agentInitialize in class Agent
        Parameters:
        firstTime - true when first called by the factory
        Throws:
        Exception - unspecialized exception
      • agentFinalize

        public void agentFinalize​(boolean lastTime)
        Finalizes the agent before it is garbaged.
        Overrides:
        agentFinalize in class Agent
        Parameters:
        lastTime - true when last called by the factory on agent deletion.
      • react

        public void react​(AgentId from,
                          Notification not)
                   throws Exception
        Distributes the received notifications to the appropriate reactions.
        Overrides:
        react in class Agent
        Parameters:
        from - agent sending notification
        not - notification to react to
        Throws:
        Exception
      • getAMQPId

        public static AgentId getAMQPId​(short serverId)
        get destination AgentId of AMQPAgent.
        Parameters:
        serverId - destination server Id.
        Returns:
        destination AgentId of AMQPAgent.
      • sendRequestTo

        public static void sendRequestTo​(Object request,
                                         short serverId,
                                         long proxyId,
                                         Long keyLock)
        send AMQP request to serverId AMQP agent. and store keyLock.
        Parameters:
        request - the request to send
        serverId - destination server Id.
        keyLock - the locker Object for synchronous call or null for async.
      • putResponse

        public static void putResponse​(AgentId from,
                                       long lock,
                                       Object response)
        Parameters:
        lock -
        response -
      • getResponse

        public static Object getResponse​(long lock)
        Parameters:
        lock -
        Returns:
      • sendRestart

        private void sendRestart()