public abstract class InboundHandler<S,D> extends ChannelHandler<InboundHandler,S,D>
InboundHandler
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.
InboundHandler
are not expected to be thread-safe; each channel
will gets its own instance(s).
A InboundHandler
is constructed through a ChannelInitializer
.
If the main task of a InboundHandler is to decode a message (e.g. a Packet),
it is best to call this handler a decoder. For example PacketDecoder.OutboundHandler
,
Networking
,
ChannelInitializer
,
ChannelErrorHandler
,
Channel
channel, dst, src
Constructor and Description |
---|
InboundHandler() |
Modifier and Type | Method and Description |
---|---|
protected void |
initSrcBuffer()
Initializes the src buffer.
|
protected void |
initSrcBuffer(int sizeBytes)
Initializes the src buffer.
|
abstract HandlerStatus |
onRead()
A callback to indicate that data is available in the src to be
processed.
|
dst, dst, handlerAdded, interceptError, setChannel, src, src
public abstract HandlerStatus onRead() throws Exception
Exception
- if something fails while reading data from the src
or processing the data (e.g. when a Packet fails to get processed). When an
exception is thrown, the ChannelErrorHandler
is called.protected final void initSrcBuffer()
ChannelOptions
using
ChannelOption.SO_RCVBUF
protected final void initSrcBuffer(int sizeBytes)
sizeBytes
- the size of the srcBuffer in bytes.Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.