public class MemberReadHandler extends Object implements ReadHandler
ReadHandler
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 PacketDispatcher
.PacketDispatcher
,
MemberWriteHandler
Modifier and Type | Field and Description |
---|---|
protected TcpIpConnection |
connection |
protected Packet |
packet |
Constructor and Description |
---|
MemberReadHandler(TcpIpConnection connection,
PacketDispatcher packetDispatcher) |
Modifier and Type | Method and Description |
---|---|
protected void |
handlePacket(Packet packet) |
void |
onRead(ByteBuffer src)
A callback to indicate that data is available in the ByteBuffer to be processed.
|
protected final TcpIpConnection connection
protected Packet packet
public MemberReadHandler(TcpIpConnection connection, PacketDispatcher packetDispatcher)
public void onRead(ByteBuffer src) throws Exception
ReadHandler
onRead
in interface ReadHandler
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. That is a task of the SocketReader
.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 TcpIpConnection
is closed. There is no point continuing with a potentially corrupted stream.protected void handlePacket(Packet packet)
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.