All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JavaGroups.MessageCorrelator

java.lang.Object
   |
   +----JavaGroups.MessageCorrelator

public class MessageCorrelator
extends Object
Relates responses with requests. Used for synchronous calls etc. Later, I plan to add support for user-defined policy objects which defines how multiple response are related to a request, e.g. first only, majority, merged response etc. Currently, only the first matching response is returned.


Constructor Index

 o MessageCorrelator()

Method Index

 o AddRequest(Message)
 o AddResponse(Message)
Adds a response for a corresponding message id to the correlation table.
 o GetResponse(long, long)
 o GetResponses(long, int, long)
Returns all reponses for a request.
 o Stop()
 o toString()

Constructors

 o MessageCorrelator
 public MessageCorrelator()

Methods

 o AddRequest
 public void AddRequest(Message m)
 o AddResponse
 public boolean AddResponse(Message m) throws Exception
Adds a response for a corresponding message id to the correlation table. If corresponding request message id is not found, false is returned, otherwise, true.

 o GetResponse
 public Message GetResponse(long req_id,
                            long timeout) throws Exception
 o GetResponses
 public Vector GetResponses(long req_id,
                            int expected_responses,
                            long timeout)
Returns all reponses for a request. A partially filled vector will be returned if a timeout occurs and not all reponses have been collected

 o Stop
 public void Stop()
 o toString
 public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index