3.绑定端口
Java · 7 notes
- 2.79 1. Instantiate the Channelhistorical
Instantiate NioServerSocketChannel through reflection, configure it as non-blocking, and create channelId, Unsafe, and pipeline.
- Netty Bind Source: Actually Binding the Listening Porthistorical
1. Code to analyze. 1.1. How NioEventLoop executes the Runnable. 1.2. What the bind task executed by NioEventLoop does, including JDK NIO bind, channelActive propagation, and registering interest in accept events.
- 2. Initialize Channelhistorical
1. Code to analyze 2. Obtain the channel pipeline and add a ChannelInitializer
- Netty Source: NioEventLoop run Methodhistorical
Code analysis of the NioEventLoop run loop: select, selector rebuild, selected-key optimization, processSelectedKeys, and asynchronous task execution.
- 2.91 3. Register the Channelhistorical
Select a NioEventLoop, create a ChannelPromise/Future, register the channel through Unsafe with the JDK NIO selector, and invoke handlerAdded/initChannel callbacks.