Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Code Block
ServiceProxy proxy = proxyFactory.getProxy();
proxy.getInvocationMetaData().setTargets(new Peer[] {peer1});
Executor executor = (Executor) proxy;
executor.execute(runnable); // note that runnable must be serializable

Controlling Remote Invocations

The way remote invocations are executed is controlled by the InvocationMetaData instance attached to ServiceProxyFactory, for inherited global set-up, and ServiceProxy, for instance specific set-up.
The following invocation parameters are available:

  • timeout: number of milliseconds a service proxy waits for a response. If a response is not received before the configured value, then the service proxy throws a ServiceInvocationException exception.
  • oneWay: boolean indicating that the invocation is a one-way one. This means that an invocation request is sent, however no response is expected.
  • targets: array of Peers to which invocation requests are dispatched. By default, invocations are done against all the Peers hosting the distributed service.
  • replyAccessor: the result of a service invocation on a given Peer is usually sent back to the invoking Peer. In specific scenario, such a behavior is inadequate meaning that the result should not be propagated back. The ReplyRequiredAssessor strategy implementation is used to provide such a flexibility and prevent results to be returned to the invoking Peer depending on the service invocation result.
  • invocationResultCombiner: when an invocation is performed against multiple Peers, the returned values of each service invocation performed on each targeted Peer need to be combined. The InvocationResultCombiner strategy implementation is used to combine multiple returned values into a single one.