Guys,
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.
WDYT?
Cheers,
--
Manik Surtani
Lead, JBoss Cache
JBoss, a division of Red Hat
Email: manik(a)jboss.org
Telephone: +44 7786 702 706
MSN: manik(a)surtani.org
Yahoo/AIM/Skype: maniksurtani