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 theInvocation
to the remote service and waits for theInvocationResult
.invokeFuture
(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Sends theInvocation
to the remote service and waits for theInvocationResult
.invokeSync
(Route route, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Sends theInvocation
to the remote service and waits for theInvocationResult
.void
setIocResolver
(ServiceLocator serviceLocator) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:RemoteInvocationDispatcher
Sends theInvocation
to 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:
invokeFuture
in interfaceRemoteInvocationDispatcher
- Parameters:
route
- theRoute
through which to send theInvocation
invocation
- the outgoingInvocation
asyncInvocationResultConsumerList
- 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:RemoteInvocationDispatcher
Sends theInvocation
to 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 underlyingFuture
is 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:
invokeAsync
in interfaceRemoteInvocationDispatcher
- Parameters:
route
- theRoute
through which to send theInvocation
invocation
- the outgoingInvocation
asyncInvocationResultConsumerList
- 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:RemoteInvocationDispatcher
Sends theInvocation
to the remote service and waits for theInvocationResult
. The suppliedConsumer<InvocationError>
will relay all encountered errors. Typically this is used with theDispatch.Type.SYNCHRONOUS
The 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:
invokeSync
in interfaceRemoteInvocationDispatcher
- Parameters:
route
- theRoute
through which to send theInvocation
invocation
- the outgoingInvocation
asyncInvocationResultConsumerList
- 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
-