F
- public interface ChannelOutboundHandler<F extends OutboundFrame>
OutboundFrame
to a ByteBuffer
. For example a Packet needs to be written to a socket,
then it is taken from the queue of pending packets, the ChannelOutboundHandler is called with the Packet and the socket buffer
as argument and will then write the content of the packet to the buffer. And on completion, the content of the buffer is
written to the socket.
ChannelOutboundHandler
are not expected to be thread-safe; each channel will gets its own instance(s).
A ChannelOutboundHandler
is constructed through a ChannelInitializer
.
For more information about the ChannelOutboundHandler (and handlers in generally), have a look at the
ChannelInboundHandler
.
If the main task of a ChannelOutboundHandler is to encode a message (e.g. a Packet), it is best to call this handler
an encoder. For example PacketEncoder.Modifier and Type | Method and Description |
---|---|
boolean |
onWrite(F frame,
ByteBuffer dst)
A callback to indicate that the Frame should be written to the destination ByteBuffer.
|
boolean onWrite(F frame, ByteBuffer dst) throws Exception
frame
- the Frame to writedst
- the destination ByteBufferException
- if something fails while writing to ByteBuffer. When an exception is thrown, the
ChannelErrorHandler
is called.Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.