Netty

Abstract

Concept

  server: socket() -> bind() -> listen() -> accept() --> read() --> write() -> close()
                                                           ^          |
                                                           |          v
  client: socket() ------------------------ connect() -> write() -> read() --> close()

Terminology

  • ChannelPipeline: chain of ChannelHandlers
  • ChannelHandler: intercepting filter of inbound or outbound events
    • ChannelInboundHandler: intercepting inbound events for read, decoder, application tail handler
    • ChannelOutboundHandler: intercepting outbound events for write, encoder

EventLoop

A Channel gets registered with an EventLoop.

All inbound and outbound events are processed on the same EventLoop no synchronization required.

Many Channels share the same EventLoop don’t block, offload instead.