public abstract class BaseSerializer extends java.lang.Object implements MessageSerializer
| Modifier and Type | Field and Description | 
|---|---|
protected static int | 
MAX_SUB_MESSAGE_HEADER_SPACE  | 
protected static int | 
NORMAL_SUB_MESSAGE_HEADER_SIZE  | 
protected java.util.Queue<DataBuffer> | 
sendBuffers
The DataBuffers available 
 | 
protected KryoSerializer | 
serializer
The kryo serializer to be used for objects 
 | 
| Constructor and Description | 
|---|
BaseSerializer()  | 
| Modifier and Type | Method and Description | 
|---|---|
ChannelMessage | 
build(java.lang.Object data,
     java.lang.Object partialBuildObject)
This method will be called repeatedly until the message is fully built 
 | 
void | 
init(Config cfg,
    java.util.Queue<DataBuffer> buffers)
Initialize the serializer, it should use the sendBuffs queue to pick a network buffer 
 | 
abstract boolean | 
serializeSingleMessage(java.lang.Object payload,
                      OutMessage sendMessage,
                      DataBuffer targetBuffer)
Builds the body of the message. 
 | 
protected static final int MAX_SUB_MESSAGE_HEADER_SPACE
protected static final int NORMAL_SUB_MESSAGE_HEADER_SIZE
protected java.util.Queue<DataBuffer> sendBuffers
protected KryoSerializer serializer
public void init(Config cfg, java.util.Queue<DataBuffer> buffers)
MessageSerializerinit in interface MessageSerializercfg - configurationbuffers - the send buffer qeuepublic ChannelMessage build(java.lang.Object data, java.lang.Object partialBuildObject)
MessageSerializerbuild in interface MessageSerializerdata - message to serializepartialBuildObject - the out message to serializepublic abstract boolean serializeSingleMessage(java.lang.Object payload,
                                               OutMessage sendMessage,
                                               DataBuffer targetBuffer)
payload - the message that needs to be builtsendMessage - the send message object that contains all the metadatatargetBuffer - the data targetBuffer to which the built message needs to be copied