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 NodeIds 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 aAsyncOperationfor 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.voidsetRemoteInvokerRegistry(RemoteInvokerRegistry remoteInvokerRegistry) 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.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:RoutingStrategyInvokes the method returning aFuture<Object>with the result. Corresponds toRemoteInvoker.invokeFuture(Invocation, List, InvocationErrorConsumer).- Specified by:
invokeFuturein interfaceRoutingStrategy- Parameters:
address- the addressinvocation- theInvocationasyncInvocationResultConsumerList- the list ofConsumer<InvocationResult>instancesasyncInvocationErrorConsumer- theInvocationErrorConsumerto 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:RoutingStrategyInvokes the method returning aAsyncOperationfor the value.- Specified by:
invokeAsyncin interfaceRoutingStrategy- Parameters:
address- the addressinvocation- theInvocationasyncInvocationResultConsumerList- the list ofConsumer<InvocationResult>instancesasyncInvocationErrorConsumer- theInvocationErrorConsumerto 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:RoutingStrategyInvokes the method, blocking until it returns on the remote end. Corresponds toRemoteInvoker.invokeFuture(Invocation, List, InvocationErrorConsumer).- Specified by:
invokeSyncin interfaceRoutingStrategy- Parameters:
address- the addressinvocation- theInvocationasyncInvocationResultConsumerList- the list ofConsumer<InvocationResult>instancesasyncInvocationErrorConsumer- theInvocationErrorConsumerto receive the error of the invocation- Returns:
- the return value of the remote invocation
- Throws:
Exception
-
getRemoteInvokerRegistry
-
setRemoteInvokerRegistry
-