Class SimpleRemoteInvocationDispatcher
java.lang.Object
dev.getelements.elements.rt.remote.SimpleRemoteInvocationDispatcher
- All Implemented Interfaces:
RemoteInvocationDispatcher
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetRoutingStrategy(Route route) invokeAsync(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Sends theInvocationto the remote service and waits for theInvocationResult.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.voidsetIocResolver(ServiceLocator serviceLocator) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.getelements.elements.rt.remote.RemoteInvocationDispatcher
invokeAsyncV, start, stop
-
Constructor Details
-
SimpleRemoteInvocationDispatcher
public SimpleRemoteInvocationDispatcher()
-
-
Method Details
-
invokeFuture
public Future<Object> invokeFuture(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Description copied from interface:RemoteInvocationDispatcherSends theInvocationto the remote service and waits for theInvocationResult. The suppliedConsumer<InvocationError>will relay all encountered errors. Typically this is used with theDispatch.Type.FUTURE- Specified by:
invokeFuturein interfaceRemoteInvocationDispatcher- 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
-
invokeAsync
public AsyncOperation invokeAsync(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Description copied from interface:RemoteInvocationDispatcherSends 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.- Specified by:
invokeAsyncin interfaceRemoteInvocationDispatcher- 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
-
invokeSync
public Object invokeSync(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) throws Exception Description copied from interface:RemoteInvocationDispatcherSends 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 byRemoteInvocationDispatcher.invokeFuture(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.- Specified by:
invokeSyncin interfaceRemoteInvocationDispatcher- 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
-
getRoutingStrategy
-
getIocResolver
-
setIocResolver
-