Class RpcClientUtil

java.lang.Object
org.apache.hadoop.ipc.RpcClientUtil

public class RpcClientUtil extends Object
This class maintains a cache of protocol versions and corresponding protocol signatures, keyed by server address, protocol and rpc kind. The cache is lazily populated.
  • Constructor Details

    • RpcClientUtil

      public RpcClientUtil()
  • Method Details

    • isMethodSupported

      public static boolean isMethodSupported(Object rpcProxy, Class<?> protocol, RPC.RpcKind rpcKind, long version, String methodName) throws IOException
      Returns whether the given method is supported or not. The protocol signatures are fetched and cached. The connection id for the proxy provided is re-used.
      Parameters:
      rpcProxy - Proxy which provides an existing connection id.
      protocol - Protocol for which the method check is required.
      rpcKind - The RpcKind for which the method check is required.
      version - The version at the client.
      methodName - Name of the method.
      Returns:
      true if the method is supported, false otherwise.
      Throws:
      IOException - raised on errors performing I/O.
    • methodToTraceString

      public static String methodToTraceString(Method method)
      Convert an RPC method to a string. The format we want is 'MethodOuterClassShortName#methodName'. For example, if the method is: org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos. ClientNamenodeProtocol.BlockingInterface.getServerDefaults the format we want is: ClientNamenodeProtocol#getServerDefaults
      Parameters:
      method - input method.
      Returns:
      methodToTraceString.
    • toTraceName

      public static String toTraceName(String fullName)
      Convert an RPC class method to a string. The format we want is 'SecondOutermostClassShortName#OutermostClassShortName'. For example, if the full class name is: org.apache.hadoop.hdfs.protocol.ClientProtocol.getBlockLocations the format we want is: ClientProtocol#getBlockLocations
      Parameters:
      fullName - input fullName.
      Returns:
      toTraceName.