com.hazelcast.client.impl.protocol
public class ClientMessage extends MessageFlyweight implements SocketWritable, SocketReadable
Client Message is the carrier framed data as defined below.
Any request parameter, response or event data will be carried in the payload.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |R| Frame Length | +-------------+---------------+---------------------------------+ | Version |B|E| Flags | Type | +-------------+---------------+---------------------------------+ | CorrelationId | +---------------------------------------------------------------+ | PartitionId | +-----------------------------+---------------------------------+ | Data Offset | | +-----------------------------+ | | Message Payload Data ... | ...
Modifier and Type | Field and Description |
---|---|
static short |
BEGIN_AND_END_FLAGS
Begin and End Flags
|
static short |
BEGIN_FLAG
Begin Flag
|
static short |
END_FLAG
End Flag
|
static int |
HEADER_SIZE
ClientMessage Fixed Header size in bytes
|
static short |
LISTENER_EVENT_FLAG
Listener Event Flag
|
static short |
VERSION
Current protocol version
|
buffer
Constructor and Description |
---|
ClientMessage() |
Modifier and Type | Method and Description |
---|---|
ClientMessage |
addFlag(short flags)
Sets the flags field value.
|
static ClientMessage |
create() |
static ClientMessage |
createForDecode(ClientProtocolBuffer buffer,
int offset) |
static ClientMessage |
createForEncode(ClientProtocolBuffer buffer,
int offset) |
static ClientMessage |
createForEncode(int initialCapacity) |
int |
getCorrelationId()
Returns the correlation id field.
|
int |
getDataOffset()
Returns the setDataOffset field.
|
short |
getFlags()
Returns the flags field value.
|
int |
getFrameLength()
Returns the frame length field.
|
int |
getMessageType()
Returns the message type field.
|
int |
getPartitionId()
Returns the partition id field.
|
short |
getVersion()
Returns the version field value.
|
boolean |
isComplete()
Checks the frame size and total data size to validate the message size.
|
boolean |
isFlagSet(short flag) |
boolean |
isRetryable() |
boolean |
isUrgent()
Checks if this SocketWritable is urgent.
|
boolean |
readFrom(ByteBuffer source) |
ClientMessage |
setCorrelationId(int correlationId)
Sets the correlation id field.
|
ClientMessage |
setDataOffset(int dataOffset)
Sets the dataOffset field.
|
ClientMessage |
setFrameLength(int length)
Sets the frame length field.
|
ClientMessage |
setMessageType(int type)
Sets the message type field.
|
ClientMessage |
setPartitionId(int partitionId)
Sets the partition id field.
|
void |
setRetryable(boolean isRetryable) |
ClientMessage |
setVersion(short version)
Sets the version field value.
|
String |
toString() |
ClientMessage |
updateFrameLength() |
protected void |
wrapForDecode(ClientProtocolBuffer buffer,
int offset) |
protected void |
wrapForEncode(ClientProtocolBuffer buffer,
int offset) |
boolean |
writeTo(ByteBuffer destination)
Asks the SocketWritable to write its content to the destination ByteBuffer.
|
buffer, getBoolean, getByteArray, getData, getDataList, getDataSet, getInt, getLong, getStringUtf8, index, index, int32Get, int32Set, set, set, set, set, set, set, set, uint16Get, uint16Put, uint32Get, uint32Put, uint8Get, uint8Put, wrap
public static final short VERSION
public static final short BEGIN_FLAG
public static final short END_FLAG
public static final short BEGIN_AND_END_FLAGS
public static final short LISTENER_EVENT_FLAG
public static final int HEADER_SIZE
public static ClientMessage create()
public static ClientMessage createForEncode(int initialCapacity)
public static ClientMessage createForEncode(ClientProtocolBuffer buffer, int offset)
public static ClientMessage createForDecode(ClientProtocolBuffer buffer, int offset)
protected void wrapForEncode(ClientProtocolBuffer buffer, int offset)
protected void wrapForDecode(ClientProtocolBuffer buffer, int offset)
public short getVersion()
public ClientMessage setVersion(short version)
version
- The value to set in the version field.public boolean isFlagSet(short flag)
flag
- Check this flag to see if it is set.public short getFlags()
public ClientMessage addFlag(short flags)
flags
- The value to set in the flags field.public int getMessageType()
public ClientMessage setMessageType(int type)
type
- The value to set in the message type field.public int getFrameLength()
public ClientMessage setFrameLength(int length)
length
- The value to set in the frame length field.public int getCorrelationId()
public ClientMessage setCorrelationId(int correlationId)
correlationId
- The value to set in the correlation id field.public int getPartitionId()
public ClientMessage setPartitionId(int partitionId)
partitionId
- The value to set in the partitions id field.public int getDataOffset()
public ClientMessage setDataOffset(int dataOffset)
dataOffset
- The value to set in the dataOffset field.public ClientMessage updateFrameLength()
public boolean writeTo(ByteBuffer destination)
SocketWritable
writeTo
in interface SocketWritable
destination
- the ByteBuffer to write to.public boolean readFrom(ByteBuffer source)
readFrom
in interface SocketReadable
public boolean isComplete()
public boolean isUrgent()
SocketWritable
isUrgent
in interface SocketWritable
public void setRetryable(boolean isRetryable)
public boolean isRetryable()
Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.