public class PacketDecoder extends ChannelInboundHandlerWithCounters
ChannelInboundHandler
for member to member communication.
It reads as many packets from the src ByteBuffer as possible, and each of the Packets is send to the PacketHandler
.PacketHandler
,
PacketEncoder
Modifier and Type | Field and Description |
---|---|
protected TcpIpConnection |
connection |
normalPacketsRead, priorityPacketsRead
Constructor and Description |
---|
PacketDecoder(TcpIpConnection connection,
PacketHandler handler) |
Modifier and Type | Method and Description |
---|---|
protected void |
onPacketComplete(Packet packet) |
void |
onRead(ByteBuffer src)
A callback to indicate that data is available in the src ByteBuffer to be processed.
|
setNormalPacketsRead, setPriorityPacketsRead
protected final TcpIpConnection connection
public PacketDecoder(TcpIpConnection connection, PacketHandler handler)
public void onRead(ByteBuffer src) throws Exception
ChannelInboundHandler
src
- the ByteBuffer containing the data to read. The ByteBuffer is already in reading mode and when completed,
should not be converted to write-mode using clear/compact.Exception
- if something fails while reading data from the ByteBuffer or processing the data (e.g. when a Packet
fails to get processed). When an exception is thrown, the ChannelErrorHandler
is called.Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.