On 9 Jul 2009, at 13:15, Bela Ban wrote:
Manik Surtani wrote:
>
> On 9 Jul 2009, at 12:08, Bela Ban wrote:
>
>> What's the issue here ?
>
> The issue is that the RspFilter never finds a valid response
> (assume that this is because the "right answer" does not exist).
So if you have 10 members when you send the request, and expect 10
responses, if none of them are acceptable, simply return false at
the 10th response from needMoreResponses().
The problem is that if you install a RspFilter, it will *override*
the response collection normally done in JGroups, ie. normally we'd
return after 10 responses (with GET_ALL and/or a timeout).
OK, so we have either the normal completion checking or your
overridden needsMoreResponses() callback.
Currently the logical is as follows:
if( rsp filter installed): call needsMoreResponses()
else: regular completion check
I could change this, and essentially OR these 2 checks together, as
follows:
boolean regular_complete=regular completion checking
boolean needs_more_rsps=call needsMoreResponses()
boolean complete=regular_complete || needs_more_responses;
This would return after 10 responses even if needsMoreResponses()
returns true.
Note that this won't work though isAcceptable() flags 1 or more
responses as false. In this case, the regular response completion
check would return false.
> In this case, needMoreResponses() would always return true. I
> remember that in JBC3, when this happened, JGroups timed out
> waiting for responses even though all responses had come in; the
> filter just rejected all of them.
Correct. This is as designed.
> I found that the workaround was for needMoreResponses() to return
> true if we hadn't found the right answer AND there were more
> responses we hadn't considered yet.
Exactly
> Otherwise return false, since you know there are no more responses
> to consider anyway.
Yes. Let me know if you think the above change would help. Again,
this change would only help if isAcceptable() returns true !
I am happy with the current behaviour; I don't think it is necessarily
incorrect. Just that I didn't initially expect it to work that way.
Perhaps some Javadocs detailing this in RspFilter may make things more
explicit.
Cheers
--
Manik Surtani
manik(a)jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org