Search code examples
javacluster-computingdistributed-computingrpcjgroups

How to exclude calling class in JGroups RpcDispatcher calls


I want a single class to invoke the same method in multiple other classes, without trying to do so on itself.

For example, RpcDispatcher calling rsp_list = disp.callRemoteMethods(null, "print", new Object[]{10}, new Class[]{int.class}, opts); should not try and invoke print on itself, only the other channel members.


Solution

  • You could use an exclusion list in RequestOptions passed to the call, or use TransientFlag.DONT_LOOPBACK (preferred, as more efficient). The transient flag is also set in RequestOptions.