next up previous contents
Next: The MAFFinderServiceProxy Up: Communication Services Previous: Sending synchronous Messages   Contents

Sending FutureMessages

The FutureMessage are kind of asynchronous messages like described in the requirements section. The Agent is not blocked until the response arrives in contrast to the synchronous messages. Instead it gets a FutureResult object which will contain the response later when arrived. The Agent can now poll this FutureResult object and extract the response when available. If a message can last a longer time this is the recommended method to send messages. Anyway it can be used also for message that do not last very long but are not needed in the next instruction.

An Agent calls the sendFutureMessage on its communication proxy. This results in the same call on the System Agent. The System Agent now creates a new, still empty FutureResult object. Then it creates a FutureResultThread to call the message asynchronously on the remote System, gives it the FutureResult object as parameter to put the result later in, starts it and then returns the FutureResult object (the reference to it, like every time in java) back to the Agent. The Agent can now continue with its execution. The FutureResultThread calls the executeMessage on the target Agent in the same way as it is done when sending a synchronous message. When the result arrives it is put into the FutureResult object and the Agent can receive it there. See the Figure [*] for a process diagram. This diagram is slightly different as the figure from the requirements section, because it describes how this requirement was implemented.

Figure: Sending Future Messages
9#9

The AgentCommIFace contains another asynchronous message, sendAsyncMessage, which is still not implemented. It could be implemented like in IBM's Aglets[AGLETS] with the use of events when a response arrives. But since the Agent System provides a good asynchronous message sending mechanism it is a not very import task to implement this.


next up previous contents
Next: The MAFFinderServiceProxy Up: Communication Services Previous: Sending synchronous Messages   Contents
Thomas Letsch 2001-02-21