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.
-
MessageCorrelator()
-
-
AddRequest(Message)
-
-
AddResponse(Message)
- Adds a response for a corresponding message id to the correlation table.
-
GetResponse(long, long)
-
-
GetResponses(long, int, long)
- Returns all reponses for a request.
-
Stop()
-
-
toString()
-
MessageCorrelator
public MessageCorrelator()
AddRequest
public void AddRequest(Message m)
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.
GetResponse
public Message GetResponse(long req_id,
long timeout) throws Exception
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
Stop
public void Stop()
toString
public String toString()
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index