Class ProtocolSignature

java.lang.Object
org.apache.hadoop.ipc.ProtocolSignature
All Implemented Interfaces:
Writable

public class ProtocolSignature extends Object implements Writable
  • Constructor Details

    • ProtocolSignature

      public ProtocolSignature()
      default constructor
    • ProtocolSignature

      public ProtocolSignature(long version, int[] methodHashcodes)
      Constructor
      Parameters:
      version - server version
      methodHashcodes - hash codes of the methods supported by server
  • Method Details

    • getVersion

      public long getVersion()
    • getMethods

      public int[] getMethods()
    • readFields

      public void readFields(DataInput in) throws IOException
      Description copied from interface: Writable
      Deserialize the fields of this object from in.

      For efficiency, implementations should attempt to re-use storage in the existing object where possible.

      Specified by:
      readFields in interface Writable
      Parameters:
      in - DataInput to deseriablize this object from.
      Throws:
      IOException - any other problem for readFields.
    • write

      public void write(DataOutput out) throws IOException
      Description copied from interface: Writable
      Serialize the fields of this object to out.
      Specified by:
      write in interface Writable
      Parameters:
      out - DataOuput to serialize this object into.
      Throws:
      IOException - any other problem for write.
    • resetCache

      @VisibleForTesting public static void resetCache()
    • getProtocolSignature

      public static ProtocolSignature getProtocolSignature(int clientMethodsHashCode, long serverVersion, Class<? extends VersionedProtocol> protocol)
      Get a server protocol's signature
      Parameters:
      clientMethodsHashCode - client protocol methods hashcode
      serverVersion - server protocol version
      protocol - protocol
      Returns:
      the server's protocol signature
    • getProtocolSignature

      public static ProtocolSignature getProtocolSignature(String protocolName, long version) throws ClassNotFoundException
      Throws:
      ClassNotFoundException
    • getProtocolSignature

      public static ProtocolSignature getProtocolSignature(VersionedProtocol server, String protocol, long clientVersion, int clientMethodsHash) throws IOException
      Get a server protocol's signature
      Parameters:
      server - server implementation
      protocol - server protocol
      clientVersion - client's version
      clientMethodsHash - client's protocol's hash code
      Returns:
      the server protocol's signature
      Throws:
      IOException - if any error occurs