private void applyOptions()

in impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingServer.java [138:166]


    private void applyOptions(ServerBootstrap bootstrap) {
        //option() is for the NioServerSocketChannel that accepts incoming connections.
        //childOption() is for the Channels accepted by the parent ServerChannel, which is NioServerSocketChannel in this case
        if (null != serverConfig) {
            if (serverConfig.getTcpSoBacklogSize() > 0) {
                bootstrap.option(ChannelOption.SO_BACKLOG, serverConfig.getTcpSoBacklogSize());
            }

            if (serverConfig.getTcpSoLinger() > 0) {
                bootstrap.option(ChannelOption.SO_LINGER, serverConfig.getTcpSoLinger());
            }

            if (serverConfig.getTcpSoSndBufSize() > 0) {
                bootstrap.childOption(ChannelOption.SO_SNDBUF, serverConfig.getTcpSoSndBufSize());
            }
            if (serverConfig.getTcpSoRcvBufSize() > 0) {
                bootstrap.childOption(ChannelOption.SO_RCVBUF, serverConfig.getTcpSoRcvBufSize());
            }

            bootstrap.option(ChannelOption.SO_REUSEADDR, serverConfig.isTcpSoReuseAddress()).
                childOption(ChannelOption.SO_KEEPALIVE, serverConfig.isTcpSoKeepAlive()).
                childOption(ChannelOption.TCP_NODELAY, serverConfig.isTcpSoNoDelay()).
                option(ChannelOption.CONNECT_TIMEOUT_MILLIS, serverConfig.getTcpSoTimeoutMillis());

            if (serverConfig.isServerPooledBytebufAllocatorEnable()) {
                bootstrap.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
            }
        }
    }