Next: Creating a TAgent
Up: System
Previous: System
  Contents
The communication of an Agent exists of two parts, the transfer of an Agent
to another System and of sending a message to an Agent residing on another System.
The transfer of a TAgent is started with the sendMe2OtherSite
method of the TAgentSite. This method can be accessed through
the TAgentHelper (see next section about Agents) by an Agent
or through RMI using the TAgentLauncher. The platform uses
the following protocol for transporting an Agent:
- The client (Agent) calls the method sendMe2OtherSite(TAgentId tagentid,
String host, String name) which instructs the platform to send the Agent with
the specified id to the System with the specified name running on the given
host.
- The local System calls the method request2Send through RMI on the target
System.
- The target System answers by calling the method ok2Receive on the local
System which instructs the local System to stop the Agent.
- Now calls the target System the method requestResources which returns
the URL of the classes of the Agent to be transfered.
- The next step is the call of the method requestAgent on the local (sender)
System. It should return the TAgent object which had to be transfered. Now the
target System has the Agent.
- The target System calls now the method endOfReceive to end the transmission.
The sender System stores the new location of the Agent in its hash table hashtableTravellerTAgents
to be able to access the Agent in future. At last the AgentId is removed from
the hash table of running Agents on this (the local) System.
To keep track of the Agents when they are traveling, the platforms are storing
the next location of an Agent when traveling in a hash table.
The transfer of a message to an Agent is done by the following protocol:
- The client (Agent) calls the method sendTAgentMessage(TAgentId tagentid,
TAgentMessage tagentmessage) on the platform, through its helper.
- If the Agent resides in this platform, the System looks for the TAgentLoader
and calls the method handleTAgentMessage on it.
- If the Agent does not (or no longer) reside in this platform, its next location
should be stored in the hashtableTravellerTAgents. If it is found there,
the System just calls the same method (sendTAgentMessage) with the
same parameters on the next platform through RMI. If it is not found, it returns
a TAgentResponse with an error code.
The sending of a message to an Agent is only possible when the sender Agent
resides on a System that has created the receiver Agent, or it has been there
at least one time while traveling.
Next: Creating a TAgent
Up: System
Previous: System
  Contents
Thomas Letsch
2001-02-21