Interface RemoteInvocationDispatcher
- All Known Implementing Classes:
SimpleRemoteInvocationDispatcher
public interface RemoteInvocationDispatcher
-
Method Summary
Modifier and TypeMethodDescriptioninvokeAsync(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Sends theInvocationto the remote service and waits for theInvocationResult.default VoidinvokeAsyncV(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) InvokesinvokeAsyncV(Route, Invocation, List, InvocationErrorConsumer), ignoring the returnedAsyncOperation.invokeFuture(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Sends theInvocationto the remote service and waits for theInvocationResult.invokeSync(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Sends theInvocationto the remote service and waits for theInvocationResult.default voidstart()Starts up this dispatcher.default voidstop()Stops thisRemoteInvoker.
-
Method Details
-
start
default void start()Starts up this dispatcher. The default implementation of this method does nothing in case no setup is necessary. -
stop
default void stop()Stops thisRemoteInvoker. This method must gracefully shut down all connections and stop any worker threads. THe default implementation of this method does nothing in case no shutdown is necessary. -
invokeAsyncV
default Void invokeAsyncV(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) InvokesinvokeAsyncV(Route, Invocation, List, InvocationErrorConsumer), ignoring the returnedAsyncOperation. -
invokeAsync
AsyncOperation invokeAsync(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Sends theInvocationto the remote service and waits for theInvocationResult. The suppliedConsumer<InvocationError>will relay all encountered errors. Typically this is used with theDispatch.Type.ASYNCHRONOUS. This returns the generic Void type to clarify the intention of the method that the underlyingFutureis discarded, but since is is intended to be used with reflections code, this allows for the method to be easily adapted as such.- Parameters:
route- theRoutethrough which to send theInvocationinvocation- the outgoingInvocationasyncInvocationResultConsumerList- aList<Consumer<InvocationResult>>to capture all async resultsasyncInvocationErrorConsumer- aConsumer<InvocationError>to receive async errors- Returns:
- a null
Void, for the sake of clarity
-
invokeFuture
Future<Object> invokeFuture(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Sends theInvocationto the remote service and waits for theInvocationResult. The suppliedConsumer<InvocationError>will relay all encountered errors. Typically this is used with theDispatch.Type.FUTURE- Parameters:
route- theRoutethrough which to send theInvocationinvocation- the outgoingInvocationasyncInvocationResultConsumerList- aList<Consumer<InvocationResult>>to capture all async resultsasyncInvocationErrorConsumer- aConsumer<InvocationError>to receive async errors- Returns:
- a
Future<Object>which returns the result of the remote invocation
-
invokeSync
Object invokeSync(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) throws Exception Sends theInvocationto the remote service and waits for theInvocationResult. The suppliedConsumer<InvocationError>will relay all encountered errors. Typically this is used with theDispatch.Type.SYNCHRONOUSThe default implementation of this method simply uses theFuture<Object>returned by the method defined byinvokeFuture(Route, Invocation, List, InvocationErrorConsumer)and blocks onFuture.get(). However, the underlying implementation should override this method to implement a more efficient means of blocking, such as actually blocking on the underlying network socket.- Parameters:
route- theRoutethrough which to send theInvocationinvocation- the outgoingInvocationasyncInvocationResultConsumerList- aList<Consumer<InvocationResult>>to capture all async resultsasyncInvocationErrorConsumer- aConsumer<InvocationError>to receive async errors- Returns:
- the result of the remote
Invocation - Throws:
Exception
-