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 anEventLoop
.All inbound and outbound events are processed on the same
EventLoop
⇒ no synchronization required.Many
Channels
share the sameEventLoop
⇒ don’t block, offload instead.