Package org.apache.hadoop.ipc
Class ProtobufWrapperLegacy
java.lang.Object
org.apache.hadoop.ipc.RpcWritable
org.apache.hadoop.ipc.ProtobufWrapperLegacy
- All Implemented Interfaces:
Writable
A RpcWritable wrapper for unshaded protobuf messages.
This class isolates unshaded protobuf classes from
the rest of the RPC codebase, so it can operate without
needing that on the classpath at runtime.
The classes are needed at compile time; and if
unshaded protobuf messages are to be marshalled, they
will need to be on the classpath then.
That is implicit: it is impossible to pass in a class
which is a protobuf message unless that condition is met.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.ipc.RpcWritable
RpcWritable.Buffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.google.protobuf.Messagestatic booleanisUnshadedProtobufMessage(Object payload) Is a message an unshaded protobuf message?protected <T> TreadFrom(ByteBuffer bb) voidwriteTo(ResponseBuffer out) Methods inherited from class org.apache.hadoop.ipc.RpcWritable
readFields, write
-
Constructor Details
-
ProtobufWrapperLegacy
Construct. The type of the parameter is Object so as to keep the casting internal to this class.- Parameters:
message- message to wrap.- Throws:
IllegalArgumentException- if the class is not a protobuf message.
-
-
Method Details
-
getMessage
public com.google.protobuf.Message getMessage() -
writeTo
- Throws:
IOException
-
readFrom
- Throws:
IOException
-
isUnshadedProtobufMessage
Is a message an unshaded protobuf message?- Parameters:
payload- payload- Returns:
- true if protobuf.jar is on the classpath and the payload is a Message
-