java.lang.Object
org.apache.hadoop.hdfs.server.federation.router.RemoteMethod

public class RemoteMethod extends Object
Determines the remote client protocol method and the parameter list for a specific location.
  • Constructor Details

    • RemoteMethod

      public RemoteMethod(String method)
      Create a remote method generator for the ClientProtocol with no parameters.
      Parameters:
      method - The string name of the protocol method.
    • RemoteMethod

      public RemoteMethod(Class<?> proto, String method)
      Create a method with no parameters.
      Parameters:
      proto - Protocol of the method.
      method - The string name of the ClientProtocol method.
    • RemoteMethod

      public RemoteMethod(String method, Class<?>[] pTypes, Object... pParams) throws IOException
      Create a remote method generator for the ClientProtocol.
      Parameters:
      method - The string name of the ClientProtocol method.
      pTypes - A list of types to use to locate the specific method.
      pParams - A list of parameters for the method. The order of the parameter list must match the order and number of the types. Parameters are grouped into 2 categories:
      • Static parameters that are immutable across locations.
      • Dynamic parameters that are determined for each location by a RemoteParam object. To specify a dynamic parameter, pass an instance of RemoteParam in place of the parameter value.
      Throws:
      IOException - If the types and parameter lists are not valid.
    • RemoteMethod

      public RemoteMethod(Class<?> proto, String method, Class<?>[] pTypes, Object... pParams) throws IOException
      Creates a remote method generator.
      Parameters:
      proto - Protocol of the method.
      method - The string name of the ClientProtocol method.
      pTypes - A list of types to use to locate the specific method.
      pParams - A list of parameters for the method. The order of the parameter list must match the order and number of the types. Parameters are grouped into 2 categories:
      • Static parameters that are immutable across locations.
      • Dynamic parameters that are determined for each location by a RemoteParam object. To specify a dynamic parameter, pass an instance of RemoteParam in place of the parameter value.
      Throws:
      IOException - If the types and parameter lists are not valid.
  • Method Details

    • getProtocol

      public Class<?> getProtocol()
      Get the interface/protocol for this method. For example, ClientProtocol or NamenodeProtocol.
      Returns:
      Protocol for this method.
    • getMethod

      public Method getMethod() throws IOException
      Get the represented java method.
      Returns:
      Method
      Throws:
      IOException - If the method cannot be found.
    • getTypes

      public Class<?>[] getTypes()
      Get the calling types for this method.
      Returns:
      An array of calling types.
    • getParams

      public Object[] getParams()
      Generate a list of parameters for this specific location using no context.
      Returns:
      A list of parameters for the method customized for the location.
    • getMethodName

      public String getMethodName()
      Get the name of the method.
      Returns:
      Name of the method.
    • getParams

      public Object[] getParams(RemoteLocationContext context)
      Generate a list of parameters for this specific location. Parameters are grouped into 2 categories:
      • Static parameters that are immutable across locations.
      • Dynamic parameters that are determined for each location by a RemoteParam object.
      Parameters:
      context - The context identifying the location.
      Returns:
      A list of parameters for the method customized for the location.
    • toString

      public String toString()
      Overrides:
      toString in class Object