Class SameNodeIdRoutingStrategy
java.lang.Object
dev.getelements.elements.rt.routing.SameNodeIdRoutingStrategy
- All Implemented Interfaces:
RoutingStrategy
A
RoutingStrategy
which ensures that accepts all address components are instances of HasNodeId
and
that all NodeId
instances point to the same place. Instances of HasNodeId
which do not specify the
NodeId
will be ignored and the call dispatched to the specific NodeId
that it determines or an
exception will be thrown otherwise.
If no NodeId
s can be determined from the address, then an exception is thrown. However, this will ensure
that the call will be routed to a specific node with the determined NodeId
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioninvokeAsync
(List<Object> address, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Invokes the method returning aAsyncOperation
for the value.invokeFuture
(List<Object> address, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) invokeSync
(List<Object> address, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Invokes the method, blocking until it returns on the remote end.void
setRemoteInvokerRegistry
(RemoteInvokerRegistry remoteInvokerRegistry) 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.RoutingStrategy
invokeAsyncV
-
Constructor Details
-
SameNodeIdRoutingStrategy
public SameNodeIdRoutingStrategy()
-
-
Method Details
-
invokeFuture
public Future<Object> invokeFuture(List<Object> address, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Description copied from interface:RoutingStrategy
Invokes the method returning aFuture<Object>
with the result. Corresponds toRemoteInvoker.invokeFuture(Invocation, List, InvocationErrorConsumer)
.- Specified by:
invokeFuture
in interfaceRoutingStrategy
- Parameters:
address
- the addressinvocation
- theInvocation
asyncInvocationResultConsumerList
- the list ofConsumer<InvocationResult>
instancesasyncInvocationErrorConsumer
- theInvocationErrorConsumer
to receive the error of the invocation- Returns:
- the
Future<Object>
to handle the return value
-
invokeAsync
public AsyncOperation invokeAsync(List<Object> address, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Description copied from interface:RoutingStrategy
Invokes the method returning aAsyncOperation
for the value.- Specified by:
invokeAsync
in interfaceRoutingStrategy
- Parameters:
address
- the addressinvocation
- theInvocation
asyncInvocationResultConsumerList
- the list ofConsumer<InvocationResult>
instancesasyncInvocationErrorConsumer
- theInvocationErrorConsumer
to receive the error of the invocation- Returns:
- an instance of
AsyncOperation
-
invokeSync
public Object invokeSync(List<Object> address, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) throws Exception Description copied from interface:RoutingStrategy
Invokes the method, blocking until it returns on the remote end. Corresponds toRemoteInvoker.invokeFuture(Invocation, List, InvocationErrorConsumer)
.- Specified by:
invokeSync
in interfaceRoutingStrategy
- Parameters:
address
- the addressinvocation
- theInvocation
asyncInvocationResultConsumerList
- the list ofConsumer<InvocationResult>
instancesasyncInvocationErrorConsumer
- theInvocationErrorConsumer
to receive the error of the invocation- Returns:
- the return value of the remote invocation
- Throws:
Exception
-
getRemoteInvokerRegistry
-
setRemoteInvokerRegistry
-