Skip to content

ServerBootstrapAcceptor

ServerBootstrapAcceptor is a specific component in the Netty framework that acts as a [[ChannelHandler]] within the server bootstrap process^[600-developer-big-data-netty-netty-02.md]. It is added to the [[pipeline]] during the server channel initialization phase^[600-developer-big-data-netty-netty-02.md].

Role in Server Initialization

When a server channel is created and initialized via AbstractBootstrap#doBind(), the init(channel) method configures various parameters and options.^[600-developer-big-data-netty-netty-02.md] As part of this configuration, a new instance of ServerBootstrapAcceptor is constructed and added to the end of the channel's pipeline^[600-developer-big-data-netty-netty-02.md]. This handler is responsible for accepting incoming connection requests and initializing the child channels for those connections.

Constructor Parameters

The instantiation of ServerBootstrapAcceptor captures essential configuration context required for handling new connections^[600-developer-big-data-netty-netty-02.md]:

  • ch: The server channel (NioServerSocketChannel).
  • currentChildGroup: The EventLoopGroup designated to handle the accepted channels' I/O operations.
  • currentChildHandler: The ChannelHandler that will be added to the pipeline of each new accepted connection.
  • currentChildOptions: The channel options to apply to each new connection.
  • currentChildAttrs: The attributes to apply to each new connection.

Sources

  • 600-developer-big-data-netty-netty-02.md