Package org.apache.hadoop.ipc
Class ProtocolSignature
java.lang.Object
org.apache.hadoop.ipc.ProtocolSignature
- All Implemented Interfaces:
Writable
-
Constructor Summary
ConstructorsConstructorDescriptiondefault constructorProtocolSignature(long version, int[] methodHashcodes) Constructor -
Method Summary
Modifier and TypeMethodDescriptionint[]static ProtocolSignaturegetProtocolSignature(int clientMethodsHashCode, long serverVersion, Class<? extends VersionedProtocol> protocol) Get a server protocol's signaturestatic ProtocolSignaturegetProtocolSignature(String protocolName, long version) static ProtocolSignaturegetProtocolSignature(VersionedProtocol server, String protocol, long clientVersion, int clientMethodsHash) Get a server protocol's signaturelongvoidreadFields(DataInput in) Deserialize the fields of this object fromin.static voidvoidwrite(DataOutput out) Serialize the fields of this object toout.
-
Constructor Details
-
ProtocolSignature
public ProtocolSignature()default constructor -
ProtocolSignature
public ProtocolSignature(long version, int[] methodHashcodes) Constructor- Parameters:
version- server versionmethodHashcodes- hash codes of the methods supported by server
-
-
Method Details
-
getVersion
public long getVersion() -
getMethods
public int[] getMethods() -
readFields
Description copied from interface:WritableDeserialize the fields of this object fromin.For efficiency, implementations should attempt to re-use storage in the existing object where possible.
- Specified by:
readFieldsin interfaceWritable- Parameters:
in-DataInputto deseriablize this object from.- Throws:
IOException- any other problem for readFields.
-
write
Description copied from interface:WritableSerialize the fields of this object toout.- Specified by:
writein interfaceWritable- Parameters:
out-DataOuputto 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 hashcodeserverVersion- server protocol versionprotocol- 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 implementationprotocol- server protocolclientVersion- client's versionclientMethodsHash- client's protocol's hash code- Returns:
- the server protocol's signature
- Throws:
IOException- if any error occurs
-