[
http://jira.jboss.com/jira/browse/JGRP-518?page=comments#action_12370241 ]
Bela Ban commented on JGRP-518:
-------------------------------
#1 What do you want to do if none of the responses are acceptable ? Timeout ?
#2 How should 'discarded' (not accepted) responses look like in the RspList ? As
not-received ?
I would probably have to create a new mode GET_WITH_FILTER, which requires a valid filter.
Hmm, I could also *not* do this and leave it up to the user to make sure that the filter
always returns: for example, if you have mode GET_ALL, and discard only 1 valid response,
and don't have a timeot, you'd block forever.
Idea: if I marked every response I received which PASSED the filter as RECEIVED and every
response which FAILED the filter as RECEIVED_NOT_ACCEPTED, then we'd know exactly
which responses passed and which ones failed.
Hmm, not good either: GET_FIRST would return as soon as 1 passed or failed response is
received; it it is failed then we'd return with a response which didn't pass the
filter.
Okay, so the simple solution is then to just drop all responses which don't pass the
filter, and it is the programmer's responsibility to make sure the call doesn't
hang forever ! Example:
- We expect responses from A,B,C
- Mode is GET_ALL and timeout is 0 (wait forever)
- Get get a response from A, discard it
- Get responses from B and C
==> We hang forever
RpcDispatcher: filter for accepting incoming responses
------------------------------------------------------
Key: JGRP-518
URL:
http://jira.jboss.com/jira/browse/JGRP-518
Project: JGroups
Issue Type: Feature Request
Reporter: Manik Surtani
Assigned To: Bela Ban
Fix For: 2.6
[Manik's email]
Are there any plans to implement a way to register a filter when using the RpcDispatcher
when waiting for results?
Current options (GroupRequest.GET_ALL, GET_NONE, GET_MOST, GET_FIRST, etc) is
insufficient where you want the call to block until the first *acceptable* response is
received.
Basically, if I expect responses from everyone in the cluster but want to wait for the
first acceptable response, I have no choice but to do a GET_ALL and then parse all the
responses for the first acceptable one. Now the definition of an acceptable response is
application-specific, and so perhaps a mechanism to register a filter would be useful.
Perhaps something like:
RpcDispatcher.callRemoteMethods(Vector dests, MethodCall call, int mode, long
timeout, boolean use_anycasting, ResponseFilter responseFilter)
public interface ResponseFilter
{
boolean isAcceptable(Object response);
}
If a filter is provided, only responses that pass the isAcceptable() test is added to the
response list. Then GroupRequest.GET_FIRST could be used and we could have a very
efficient mechanism of not having to wait for all responses.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira