Typical protocols can be divided into protocols that perform some work on a message, and then pass it up or down the stack, and protocols that interact with their peers in different protocol stacks3.6. The latter often need to send requests to their peer(s) and receive responses. However, in distributed peer computing (as is the case in groups), any member may be the originator and receiver of a request. That means that - besides sending requests and receiving the corresponding responses - every member must be enabled to process requests sent by other members and send responses. The main functions of a peer protocol are therefore
The structure of a request correlator is shown in
fig. 3.4.
Essentially, a RequestCorrelator has 1 object that is responsible for handling all requests (RequestHandler), and 0 or more response handlers (RspCollector) which will receive the response(s) for a specific request. Each request is identified by a unique ID (for example the current time in milliseconds) and added to a request table. When a response comes in, its ID is matched against the requests, the correct request is found and the response directed to it. Having multiple requests pending at any time (compared to just a single one) gives clients of request correlator more freedom: the decision whether to send a single or multiple requests at a time is theirs.
The RequestCorrelator has methods to a) send a request (synchronously or asynchronously, to a single member or to all group members), b) submit a suspicion message, c) make it receive a message and d) remove a request (calling method Done with the request ID). It allows to register a request handler which will handle all requests directed towards this request correlator.
The following actions take place when a group request is sent: