public interface ChannelInboundHandler
ChannelInboundHandler
provides control when data is received and needs to be processed. For example data
has received on the socket and needs to be decoded into a Packet.
ChannelInboundHandler
are not expected to be thread-safe; each channel will gets its own instance(s).
A ChannelInboundHandler
is constructed through a ChannelInitializer
.
If the main task of a ChannelInboundHandler is to decode a message (e.g. a Packet), it is best to call this handler a
decoder. For example PacketDecoder.Modifier and Type | Method and Description |
---|---|
void |
onRead(ByteBuffer src)
A callback to indicate that data is available in the src ByteBuffer to be processed.
|
void onRead(ByteBuffer src) throws Exception
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.