EventExecutorGroup for blocking handlers¶
EventExecutorGroup is used in Netty to offload the execution of specific ChannelHandler logic from the I/O loop threads to a separate thread pool.^[600-developer-big-data-netty-netty-channelpipeline.md] This prevents blocking operations in a handler from stalling the processing of other channels' I/O events.
Usage¶
To apply a separate thread pool to a handler, an EventExecutorGroup (such as DefaultEventExecutorGroup) is instantiated and passed as an argument when adding the handler to the pipeline.^[600-developer-big-data-netty-netty-channelpipeline.md]
EventExecutorGroup group = new DefaultEventExecutorGroup(16);
pipeline.addLast(group, "handler", new MyBusinessLogicHandler());
Related Concepts¶
- ChannelPipeline
- [[ChannelHandler]]
- [[Netty Internals]]