[jgroups-dev] RpcDispatcher change

Bela Ban <[email protected]>
Newsgroups gmane.comp.java.javagroups.devel,gmane.comp.java.javagroups.general
Message-ID <[email protected]>
In a recent change [1], I dropped the target members from an RPC. The 
reason is that, if we have a large cluster, shipping all targets with an 
RPC is costly, as each address takes up ca 20 bytes in the serialized 
form. (Not shipping the target list makes RPCs smaller and more efficient.)

Usually, this is not a problem as RPCs are invoked on all members of a 
cluster.

So if we have membership {A,B,C,D,E}, and invoke an RPC, it'll get 
invoked on everyone.

If we do define the target membership to be {A,B,C,D}, the RPC will 
still get invoked on everyone, but we'll wait for responses from 
{A,B,C,D} only, and drop the responsesfrom E.

Sometimes, this is not desirable, for example, when we have a cache and 
- when making a local change - want to send that change to everyone 
minus ourself, because we don't want to make that change twice (once 
locally and once as result of the RPC invocation).

This is what I changed: now all RPCs can provide an *exclusion list* 
[2]. In the above example, we can say that we want the RPC to be invoked 
on everyone in the cluster except E. To do this, we can write the 
following code:

RpcDispatcher disp;
Address local_addr; // my own address
RequestOptions options=new RequestOptions(Request.GET_ALL, 
5000).setExclusionList(local_addr);
RspList rsps=disp.callRemoteMethods(null, "foo", null, null, options);

The 'null' target list means 'send the RPC to all current members of the 
cluster'. The exclusion list in the request options has the local member 
(e.g. A) excluded, so

    * the RPC will get invoked on everyone except A, and
    * the response list will wait for responses from {B,C,D,E} only (or
      5 secs, whichever comes first)



[1] https://jira.jboss.org/jira/browse/JGRP-1178
[2] https://jira.jboss.org/jira/browse/JGRP-1192

-- 
Bela Ban
Lead JGroups / Clustering Team
JBoss


------------------------------------------------------------------------------
_______________________________________________
Javagroups-development mailing list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.