Netty4 を使用して、複数のクライアント接続を提供する必要があるサーバーを作成しています。ServerBootstrap は、親スレッド グループとワーカー スレッド グループで構成されます。ServerBootStrap.group() メソッドのドキュメントに従って、
「親 (アクセプター) と子 (クライアント) の EventLoopGroup を設定します。これらの EventLoopGroup は、SocketChannel と Channel のすべてのイベントと IO を処理するために使用されます。」
私が理解しているように、ParentExecutor グループは着信接続を処理し、それを Child Executor グループに渡して実行します。したがって、多くのクライアントにサーバーを提供するために、次のセットアップがあります
final ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(new NioEventLoopGroup(), new NioEventLoopGroup(Runtime.getRuntime()
.availableProcessors() * 3))
.channel(NioServerSocketChannel.class)
.childHandler(new MyInitializer());
ここで問題は、私のハンドラの次のメソッドが子エグゼキュータ グループで実行されるかどうかです。SingleThreadEventExecutor を介してシングルスレッドで処理されている疑いがありますか?
protected void channelRead0(final ChannelHandlerContext ctx, final AppMessage msg)
final AppMessage msg) throws Exception {