ChannelHandler
Handles an I/O event or intercepts an I/O operation, and forwards it to its next handler in its ChannelPipeline. ===The context object=== A ChannelHandler is provided with a ChannelHandlerContext object. A ChannelHandler is supposed to interact with the ChannelPipeline it belongs to via a context object. Using the context object, the ChannelHandler can pass events upstream or downstream, modify the pipeline dynamically, or store the information (using AttributeKeys) which is specific to the handler. ===State management=== A ChannelHandler often needs to store some stateful information. The simplest and recommended approach is to use member variables:
trait Msg {
// your methods here
}
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait Byte2ByteDecodertrait Byte2ByteCodecclass ByteToByteCodecclass SslHandlerclass ByteToByteDecoderclass Base64Decodertrait Byte2ByteEncoderclass ByteToByteEncoderclass Base64Encodertrait Byte2MessageDecoderclass ByteToMessageCodecclass ByteToMessageDecoderclass ByteArrayDecoderclass StringDecoderclass FixedLengthFrameDecodertrait Message2ByteEncoderclass MessageToByteEncoderclass ByteArrayEncoderclass LineEncoderclass StringEncodertrait Message2MessageDecodertrait Message2MessageCodectrait Message2MessageEncoderclass ChannelHandlerAdapterclass ChannelInitializer[C]class IdleStateHandlerShow all
Members list
Value members
Concrete methods
Called once a bind operation is made.
Called once a bind operation is made.
Value parameters
- ctx
-
the ChannelHandlerContext for which the bind operation is made
- local
-
the SocketAddress to which it should bound
Attributes
The Channel of the ChannelHandlerContext is now active
Gets called if a Throwable was thrown when handling inbound events.
Gets called if a Throwable was thrown when handling inbound events.
Attributes
Gets called if a Throwable was thrown when handling inbound events.
Gets called if a Throwable was thrown when handling inbound events.
Attributes
The Channel of the ChannelHandlerContext was registered is now inactive and reached its end of lifetime.
The Channel of the ChannelHandlerContext was registered is now inactive and reached its end of lifetime.
Attributes
Gets called if a custom inbound event happened.
Gets called if a custom inbound event happened.
Attributes
Invoked when the last message read by the current read operation has been consumed by channelRead. If ChannelOption.AUTO_READ is off, no further attempt to read an inbound data from the current Channel will be made until ChannelOutboundInvoker.read is called.
Invoked when the last message read by the current read operation has been consumed by channelRead. If ChannelOption.AUTO_READ is off, no further attempt to read an inbound data from the current Channel will be made until ChannelOutboundInvoker.read is called.
Attributes
The Channel of the ChannelHandlerContext was registered with its cc.otavia.core.actor.ChannelsActor
The Channel of the ChannelHandlerContext was registered with its cc.otavia.core.actor.ChannelsActor
Attributes
The Channel of the ChannelHandlerContext was shutdown in one direction. This might either be because the remote peer did cause a shutdown of one direction or the shutdown was requested explicit by us and was executed.
The Channel of the ChannelHandlerContext was shutdown in one direction. This might either be because the remote peer did cause a shutdown of one direction or the shutdown was requested explicit by us and was executed.
Value parameters
- ctx
-
the ChannelHandlerContext for which we notify about the completed shutdown.
- direction
-
the ChannelShutdownDirection of the completed shutdown.
Attributes
Gets called if a channel timeout event happened.
Gets called if a channel timeout event happened.
Value parameters
- ctx
-
ChannelHandlerContext of this handler.
- id
-
registered cc.otavia.core.timer.TimeoutTrigger id of this timeout event.
Attributes
The Channel of the ChannelHandlerContext was unregistered from its cc.otavia.core.actor.ChannelsActor
The Channel of the ChannelHandlerContext was unregistered from its cc.otavia.core.actor.ChannelsActor
Attributes
Gets called once the writable state of a Channel changed. You can check the state with Channel.writableBytes or Channel.isWritable .
Gets called once the writable state of a Channel changed. You can check the state with Channel.writableBytes or Channel.isWritable .
Attributes
Called once a close operation is made.
Called once a close operation is made.
Value parameters
- ctx
-
the ChannelHandlerContext for which the bind operation is made
Attributes
Called once a connect operation is made.
Called once a connect operation is made.
Value parameters
- ctx
-
the ChannelHandlerContext for which the bind operation is made
- local
-
the option SocketAddress which is used as source on connect
- remote
-
the SocketAddress to which it should connect
Attributes
Called once a deregister operation is made from the current registered cc.otavia.core.actor.ChannelsActor
Called once a deregister operation is made from the current registered cc.otavia.core.actor.ChannelsActor
Attributes
Called once a disconnect operation is made.
Called once a disconnect operation is made.
Value parameters
- ctx
-
the ChannelHandlerContext for which the bind operation is made
Attributes
Called once a flush operation is made. The flush operation will try to flush out all previous written messages that are pending.
Called once a flush operation is made. The flush operation will try to flush out all previous written messages that are pending.
Attributes
Gets called after the ChannelHandler was added to the actual context and it's ready to handle events.
Gets called after the ChannelHandler was added to the actual context and it's ready to handle events.
Attributes
Gets called after the ChannelHandler was removed from the actual context and it doesn't handle events anymore.
Gets called after the ChannelHandler was removed from the actual context and it doesn't handle events anymore.
Attributes
If the handler has inbound AdaptiveBuffer
If the handler has inbound AdaptiveBuffer
Attributes
If the handler has outbound AdaptiveBuffer
If the handler has outbound AdaptiveBuffer
Attributes
Attributes
- Returns
-
true if this handler is sharable and thus can be added to more than one ChannelPipeline. By default, this method returns false. If this method returns false, you have to create a new handler instance every time you add it to a pipeline because it has unshared state such as member variables.
Called once a open operation is made.
Called once a open operation is made.
Value parameters
- attrs
-
An optional list of file attributes to set atomically when creating the file
- ctx
-
the ChannelHandlerContext for which the bind operation is made
- options
-
Options specifying how the file is opened
- path
-
The path of the file to open or create
Attributes
The number of the outbound bytes that are buffered / queued in this ChannelHandler. This number will affect the writability of the Channel together the buffered / queued bytes in the Channel itself. By default this methods returns 0. If the ChannelHandler implementation buffers / queues outbound data this methods should be implemented to return the correct value.
The number of the outbound bytes that are buffered / queued in this ChannelHandler. This number will affect the writability of the Channel together the buffered / queued bytes in the Channel itself. By default this methods returns 0. If the ChannelHandler implementation buffers / queues outbound data this methods should be implemented to return the correct value.
Value parameters
- ctx
-
the ChannelHandlerContext for which the bind operation is made
Attributes
- Returns
-
the number of buffered / queued bytes.
Called once a read operation is made from the current registered cc.otavia.core.actor.ChannelsActor. If the ChannelHandler implementation queues the read and another read happens it is free to drop the first ReadPlan and just use the last one.
Called once a read operation is made from the current registered cc.otavia.core.actor.ChannelsActor. If the ChannelHandler implementation queues the read and another read happens it is free to drop the first ReadPlan and just use the last one.
Value parameters
- ctx
-
the ChannelHandlerContext for which the bind operation is made
- readPlan
-
The ReadPlan that should be used to allocate a Buffer if needed (for reading the data).
Attributes
Called once a register operation is made to register for IO on the cc.otavia.core.actor.ChannelsActor.
Called once a register operation is made to register for IO on the cc.otavia.core.actor.ChannelsActor.
Attributes
Called once a custom defined outbound event was sent. This operation will pass the event through the ChannelPipeline in the outbound direction.
Called once a custom defined outbound event was sent. This operation will pass the event through the ChannelPipeline in the outbound direction.
Value parameters
- ctx
-
the ChannelHandlerContext for which the bind operation is made
- event
-
the event.
Attributes
Called once a shutdown operation was requested and should be executed.
Called once a shutdown operation was requested and should be executed.
Value parameters
- ctx
-
the ChannelHandlerContext for which the bind operation is made
- direction
-
the ChannelShutdownDirection that is used.
Attributes
Called once a write operation is made. The write operation will write the messages through the ChannelPipeline. Those are then ready to be flushed to the actual Channel once Channel.flush is called.
Called once a write operation is made. The write operation will write the messages through the ChannelPipeline. Those are then ready to be flushed to the actual Channel once Channel.flush is called.
Value parameters
- ctx
-
the ChannelHandlerContext for which the bind operation is made
- msg
-
the message to write
Attributes
Called once a write operation is made. The write operation will write the messages through the ChannelPipeline. Those are then ready to be flushed to the actual Channel once Channel.flush is called.
Called once a write operation is made. The write operation will write the messages through the ChannelPipeline. Those are then ready to be flushed to the actual Channel once Channel.flush is called.
Value parameters
- ctx
-
the ChannelHandlerContext for which the bind operation is made
- msg
-
the message to write
- msgId
-
the id of the message