|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--JavaGroups.GroupRequest
Sends a message to all members of the group and waits for all responses (or timeout). Returns a boolean value (success or failure). Results (if any) can be retrieved when done.
When started an array of responses, correlating to the membership, is created. Each response
is added to the corresponding field in the array. When all fields have been set, the algorithm
terminates.
This algorithm can optionally use a suspicion service (failure detector) to detect (and
exclude from the membership) fauly members. If no suspicion service is available, timeouts
can be used instead (see Execute). When done, a list of suspected members
can be retrieved.
Because a channel might deliver requests, and responses to different requests, the
GroupRequest class cannot itself receive and process requests/responses from the
channel. A mechanism outside this class has to do this; it has to determine what the responses
are for the message sent by the Execute method and call ReceiveResponse
to do so.
Requirements: lossless delivery, e.g. acknowledgement-based message confirmation.
| Field Summary | |
static int |
GET_ABS_MAJORITY
|
static int |
GET_ALL
|
static int |
GET_FIRST
|
static int |
GET_MAJORITY
|
static int |
GET_N
|
static int |
GET_NONE
|
| Constructor Summary | |
GroupRequest(Message m,
RequestCorrelator corr,
java.util.Vector members,
int rsp_mode)
|
|
GroupRequest(Message m,
RequestCorrelator corr,
java.util.Vector members,
int rsp_mode,
long timeout,
int expected_mbrs)
|
|
| Method Summary | |
boolean |
Execute()
Sends the message. |
int |
GetNumSuspects()
|
RspList |
GetResults()
Returns the results as a RspList. |
java.util.Vector |
GetSuspects()
|
boolean |
IsDone()
|
void |
ReceiveResponse(Message m)
Callback (called by RequestCorrelator). |
void |
Reset(Message m,
int mode,
long timeout)
Resets the group request, so it can be reused for another execution. |
void |
Reset(Message m,
java.util.Vector members,
int rsp_mode,
long timeout,
int expected_rsps)
|
void |
Reset(java.util.Vector members)
|
void |
Suspect(java.lang.Object suspected_member)
Callback (called by RequestCorrelator). |
java.lang.String |
toString()
|
void |
ViewChange(View new_view)
Any member of 'membership' that is not in the new view is flagged as SUSPECTED. |
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final int GET_FIRST
public static final int GET_ALL
public static final int GET_MAJORITY
public static final int GET_ABS_MAJORITY
public static final int GET_N
public static final int GET_NONE
| Constructor Detail |
public GroupRequest(Message m,
RequestCorrelator corr,
java.util.Vector members,
int rsp_mode)
m - The message to be sentcorr - The request correlator to be used. A request correlator sends requests tagged with
a unique ID and notifies the sender when matching responses are received. The
reason GroupRequest uses it instead of a Transport is
that multiple requests/responses might be sent/received concurrently.members - The initial membership. This value reflects the membership to which the request
is sent (and from which potential responses are expected). Is reset by Reset().rsp_mode - How many responses are expected. Can be
GET_ALL: wait for all responses from non-suspected members.
A suspicion service might warn
us when a member from which a response is outstanding has crashed, so it can
be excluded from the responses. If no suspision service is available, a
timeout can be used (a value of 0 means wait forever). If a timeout of
0 is used, no suspicion service is available and a member from which we
expect a response has crashed, this methods blocks forever !.
GET_FIRST: wait for the first available response.
GET_MAJORITY: wait for the majority of all responses. The
majority is re-computed when a member is suspected.
GET_ABS_MAJORITY: wait for the majority of
all members.
This includes failed members, so it may block if no timeout is specified.
GET_N: wait for N members.
Return if n is >= membership+suspects.
GET_NONE: don't wait for any response. Essentially send an
asynchronous message to the group members.
expected_mbrs - Number of responses expected (used with GET_ALL).
public GroupRequest(Message m,
RequestCorrelator corr,
java.util.Vector members,
int rsp_mode,
long timeout,
int expected_mbrs)
timeout - Time to wait for responses (ms). A value of <= 0 means wait indefinitely
(e.g. if a suspicion service is available; timeouts are not needed).| Method Detail |
public boolean Execute()
public void Reset(Message m,
int mode,
long timeout)
public void Reset(Message m,
java.util.Vector members,
int rsp_mode,
long timeout,
int expected_rsps)
public void Reset(java.util.Vector members)
public void ReceiveResponse(Message m)
Execute returns.public void Suspect(java.lang.Object suspected_member)
GroupRequest that a member is reported as faulty (suspected).
This method would probably be called when getting a suspect message from a failure detector
(where available). It is used to exclude faulty members from the response list.public void ViewChange(View new_view)
public RspList GetResults()
public java.lang.String toString()
public int GetNumSuspects()
public java.util.Vector GetSuspects()
public boolean IsDone()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||