Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 804 Bytes

File metadata and controls

24 lines (17 loc) · 804 Bytes

Each channel has its own pipeline and it is created automatically when a new channel is created.

例子:

ChannelPipeline p = ...
p.addLast("1", new InboundHandlerA());
p.addLast("2", new InboundHandlerB());
p.addLast("3", new OutboundHandlerA());
p.addLast("4", new OutboundHandlerB());
p.addLast("5", new InboundOutboundHandlerX());

inbound

  • 如果事件是 inbound 事件,则按照 addLast 正序执行,即:1, 2, 5
  • 由于 3 和 4 没有实现 ChannelInboundHandler 所以会直接跳过

outbound

  • 如果事件是 outbound 事件,则按照 addLast 反序执行,即:5, 4, 3
  • 由于 1 和 2 没有实现 ChannelOutboundHandler, 所以会直接跳过