ChannelHandler adapters

 ChannelHandler adapters

You can use the classes ChannelInboundHandlerAdapter and ChannelOutboundHandlerAdapter

as starting points for your own ChannelHandlers. These adapters

provide basic implementations of ChannelInboundHandler and ChannelOutboundHandler

respectively. They acquire the methods of their common superinterface,

ChannelHandler, by extending the abstract class ChannelHandlerAdapter. The resulting

class hierarchy is shown in figure 6.2.

ChannelHandlerAdapter also provides the utility method isSharable(). This

method returns true if the implementation is annotated as Sharable, indicating that

it can be added to multiple ChannelPipelines (as discussed in section 2.3.1).

ChannelHandler adapters_第1张图片

The method bodies provided in ChannelInboundHandlerAdapter and ChannelOutboundHandlerAdapter

call the equivalent methods on the associated ChannelHandlerContext,

thereby(由此,从而) forwarding events to the next ChannelHandler in the pipeline.

 To use these adapter classes in your own handlers, simply extend them and override

the methods you want to customize.(继承该handler adapter实现自己的handler)

===========END===========

你可能感兴趣的:(channelhandler,adapters)