public class KeyedDataSerializer extends BaseSerializer
MAX_SUB_MESSAGE_HEADER_SPACE, NORMAL_SUB_MESSAGE_HEADER_SIZE, sendBuffers, serializer
Constructor and Description |
---|
KeyedDataSerializer() |
Modifier and Type | Method and Description |
---|---|
void |
init(Config cfg,
java.util.Queue<DataBuffer> buffers)
Initialize the serializer, it should use the sendBuffs queue to pick a network buffer
|
protected boolean |
serializeKeyedData(java.lang.Object payload,
java.lang.Object key,
DataPacker dataPacker,
DataPacker keyPacker,
SerializeState state,
DataBuffer targetBuffer)
Helper method that builds the body of the message for keyed messages.
|
boolean |
serializeSingleMessage(java.lang.Object payload,
OutMessage sendMessage,
DataBuffer targetBuffer)
Builds the body of the message.
|
build
public void init(Config cfg, java.util.Queue<DataBuffer> buffers)
MessageSerializer
init
in interface MessageSerializer
init
in class BaseSerializer
cfg
- configurationbuffers
- the send buffer qeuepublic boolean serializeSingleMessage(java.lang.Object payload, OutMessage sendMessage, DataBuffer targetBuffer)
serializeSingleMessage
in class BaseSerializer
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 copiedprotected boolean serializeKeyedData(java.lang.Object payload, java.lang.Object key, DataPacker dataPacker, DataPacker keyPacker, SerializeState state, DataBuffer targetBuffer)
payload
- the message that needs to be builtkey
- the key associated with the messagestate
- the state object of the messagetargetBuffer
- the data targetBuffer to which the built message needs to be copied