/** * Invokes a method in a cluster member and - if blocking - returns the result * @param dest The target member on which to invoke the method * @param call The call to be invoked, including method are arguments * @param opts The options (e.g. blocking, timeout etc) * @return A future from which the result can be fetched. If the callee threw an invocation, an ExecutionException * will be thrown on calling Future.get(). If the invocation was asynchronous, null will be returned. * @throws Exception Thrown if the method invocation threw an exception */ public <T> CompletableFuture<T> callRemoteMethodWithFuture(Address dest, MethodCall call, RequestOptions opts) throws Exception { if(log.isTraceEnabled()) log.trace("dest=%s, method_call=%s, options=%s", dest, call, opts); Buffer buf=methodCallToBuffer(call, marshaller); return super.sendMessageWithFuture(dest, buf, opts); }
/** * Invokes a method in a cluster member and - if blocking - returns the result * @param dest The target member on which to invoke the method * @param call The call to be invoked, including method are arguments * @param options The options (e.g. blocking, timeout etc) * @return The result. Null if the call is asynchronous (non-blocking) or if the method returns void * @throws Exception Thrown if the method invocation threw an exception, either at the caller or the callee */ public <T> T callRemoteMethod(Address dest, MethodCall call, RequestOptions options) throws Exception { Buffer buf=methodCallToBuffer(call, marshaller); T retval=super.sendMessage(dest, buf, options); if(log.isTraceEnabled()) log.trace("dest=%s, method_call=%s, options=%s, retval: %s", dest, call, options, retval); return retval; }
/** * Invokes a method in all members and expects responses from members contained in dests (or all members if dests is null). * @param dests A list of addresses. If null, we'll wait for responses from all cluster members * @param method_call The method (plus args) to be invoked * @param options A collection of call options, e.g. sync versus async, timeout etc * @return CompletableFuture A future from which the results can be fetched, or null if the RPC is asynchronous * @throws Exception If the sending of the message threw an exception. Note that <em>no</em> exception will be * thrown if any of the target members threw an exception; such an exception will be in the Rsp * element for the particular member in the RspList */ public <T> CompletableFuture<RspList<T>> callRemoteMethodsWithFuture(Collection<Address> dests, MethodCall method_call, RequestOptions options) throws Exception { if(dests != null && dests.isEmpty()) { // don't send if dest list is empty log.trace("destination list of %s() is empty: no need to send message", method_call.methodName()); return CompletableFuture.completedFuture(empty_rsplist); } Buffer buf=methodCallToBuffer(method_call, marshaller); CompletableFuture<RspList<T>> retval=super.castMessageWithFuture(dests, buf, options); if(log.isTraceEnabled()) log.trace("dests=%s, method_call=%s, options=%s", dests, method_call, options); return retval; }
/** * Invokes a method in all members and expects responses from members contained in dests (or all members if dests is null). * @param dests A list of addresses. If null, we'll wait for responses from all cluster members * @param method_call The method (plus args) to be invoked * @param opts A collection of call options, e.g. sync versus async, timeout etc * @return RspList A list of return values and flags (suspected, not received) per member, or null if the RPC is * asynchronous * @throws Exception If the sending of the message threw an exception. Note that <em>no</em> exception will be * thrown if any of the target members threw an exception, but this exception will be in the Rsp * object for the particular member in the RspList * @since 2.9 */ public <T> RspList<T> callRemoteMethods(Collection<Address> dests, MethodCall method_call, RequestOptions opts) throws Exception { if(dests != null && dests.isEmpty()) { // don't send if dest list is empty log.trace("destination list of %s() is empty: no need to send message", method_call.methodName()); return empty_rsplist; } Buffer buf=methodCallToBuffer(method_call, marshaller); RspList<T> retval=super.castMessage(dests, buf, opts); if(log.isTraceEnabled()) log.trace("dests=%s, method_call=%s, options=%s, responses: %s", dests, method_call, opts, retval); return retval; }
/** * Invokes a method in a cluster member and - if blocking - returns the result * @param dest The target member on which to invoke the method * @param call The call to be invoked, including method are arguments * @param options The options (e.g. blocking, timeout etc) * @return The result. Null if the call is asynchronous (non-blocking) or if the method returns void * @throws Exception Thrown if the method invocation threw an exception, either at the caller or the callee */ public <T> T callRemoteMethod(Address dest, MethodCall call, RequestOptions options) throws Exception { Buffer buf=methodCallToBuffer(call, marshaller); T retval=super.sendMessage(dest, buf, options); if(log.isTraceEnabled()) log.trace("dest=%s, method_call=%s, options=%s, retval: %s", dest, call, options, retval); return retval; }
/** * Invokes a method in a cluster member and - if blocking - returns the result * @param dest The target member on which to invoke the method * @param call The call to be invoked, including method are arguments * @param opts The options (e.g. blocking, timeout etc) * @return A future from which the result can be fetched. If the callee threw an invocation, an ExecutionException * will be thrown on calling Future.get(). If the invocation was asynchronous, null will be returned. * @throws Exception Thrown if the method invocation threw an exception */ public <T> CompletableFuture<T> callRemoteMethodWithFuture(Address dest, MethodCall call, RequestOptions opts) throws Exception { if(log.isTraceEnabled()) log.trace("dest=%s, method_call=%s, options=%s", dest, call, opts); Buffer buf=methodCallToBuffer(call, marshaller); return super.sendMessageWithFuture(dest, buf, opts); }
/** * Invokes a method in all members and expects responses from members contained in dests (or all members if dests is null). * @param dests A list of addresses. If null, we'll wait for responses from all cluster members * @param method_call The method (plus args) to be invoked * @param options A collection of call options, e.g. sync versus async, timeout etc * @return CompletableFuture A future from which the results can be fetched, or null if the RPC is asynchronous * @throws Exception If the sending of the message threw an exception. Note that <em>no</em> exception will be * thrown if any of the target members threw an exception; such an exception will be in the Rsp * element for the particular member in the RspList */ public <T> CompletableFuture<RspList<T>> callRemoteMethodsWithFuture(Collection<Address> dests, MethodCall method_call, RequestOptions options) throws Exception { if(dests != null && dests.isEmpty()) { // don't send if dest list is empty log.trace("destination list of %s() is empty: no need to send message", method_call.methodName()); return CompletableFuture.completedFuture(empty_rsplist); } Buffer buf=methodCallToBuffer(method_call, marshaller); CompletableFuture<RspList<T>> retval=super.castMessageWithFuture(dests, buf, options); if(log.isTraceEnabled()) log.trace("dests=%s, method_call=%s, options=%s", dests, method_call, options); return retval; }
/** * Invokes a method in all members and expects responses from members contained in dests (or all members if dests is null). * @param dests A list of addresses. If null, we'll wait for responses from all cluster members * @param method_call The method (plus args) to be invoked * @param opts A collection of call options, e.g. sync versus async, timeout etc * @return RspList A list of return values and flags (suspected, not received) per member, or null if the RPC is * asynchronous * @throws Exception If the sending of the message threw an exception. Note that <em>no</em> exception will be * thrown if any of the target members threw an exception, but this exception will be in the Rsp * object for the particular member in the RspList * @since 2.9 */ public <T> RspList<T> callRemoteMethods(Collection<Address> dests, MethodCall method_call, RequestOptions opts) throws Exception { if(dests != null && dests.isEmpty()) { // don't send if dest list is empty log.trace("destination list of %s() is empty: no need to send message", method_call.methodName()); return empty_rsplist; } Buffer buf=methodCallToBuffer(method_call, marshaller); RspList<T> retval=super.castMessage(dests, buf, opts); if(log.isTraceEnabled()) log.trace("dests=%s, method_call=%s, options=%s, responses: %s", dests, method_call, opts, retval); return retval; }