Class MethodParamRemoteRoutingHandler

java.lang.Object
org.openspaces.remoting.MethodParamRemoteRoutingHandler
All Implemented Interfaces:
RemoteRoutingHandler

public class MethodParamRemoteRoutingHandler extends Object implements RemoteRoutingHandler
A default implementation of routing handler allowing to control the routing index of the remote invocation based on the remote method parameters.

Uses the setDefaultParamIndex(int) as the default parameter index (starting from 0) that will be used as the hash code. Also allows to configure per method param index by setting setMethodParamIndex(java.util.Map) (which has a method name as the key and the param index as the value).

Author:
kimchy
  • Constructor Details

    • MethodParamRemoteRoutingHandler

      public MethodParamRemoteRoutingHandler()
  • Method Details

    • setDefaultParamIndex

      public void setDefaultParamIndex(int defaultParamIndex)
      The default paramter index (starting from 0) that will be used as the hash code to compute the remote routing index.
    • setMethodParamIndex

      public void setMethodParamIndex(Map<String,Integer> methodParamIndex)
      Configures per method parameter index (starting from 0) that wil be used as the hash code to compute the routing index. The map key is the method name and its value is the param index.
    • computeRouting

      public Object computeRouting(SpaceRemotingInvocation remotingEntry)
      Description copied from interface: RemoteRoutingHandler
      Returns the routing field value based on the remoting invocation. If null is returned, will use internal calcualtion of the routing index.
      Specified by:
      computeRouting in interface RemoteRoutingHandler