[
http://jira.jboss.com/jira/browse/JGRP-518?page=comments#action_12370376 ]
Bela Ban commented on JGRP-518:
-------------------------------
Ok. The interface is:
public interface RspFilter {
/**
* Determines whether a response from a given sender should be added to the response
list of the request
* @param response The response (usually a serializable value)
* @param sender The sender of response
* @return True if we should add the response to the response list ({@link
org.jgroups.util.RspList}) of a request,
* otherwise false. In the latter case, we don't add the response to the response
list.
*/
boolean isAcceptable(Object response, Address sender);
/**
* Right after calling {@link #isAcceptable(Object, org.jgroups.Address)}, this method
is called to see whether
* we are done with the request and can unblock the caller
* @return True if the request is done, otherwise false
*/
boolean needMoreResponses();
}
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