NioEventLoopGroup¶
NioEventLoopGroup is a specific implementation class within the Netty framework, functioning as a multithreaded event loop group designed to handle I/O operations and execute tasks^[600-developer-big-data-netty-netty-eventloopgroup.md].
Class Hierarchy and Inheritance¶
NioEventLoopGroup is part of a structured hierarchy that implements the EventExecutorGroup interface^[600-developer-big-data-netty-netty-eventloopgroup.md]. It extends MultithreadEventLoopGroup, which in turn extends MultithreadEventExecutorGroup^[600-developer-big-data-netty-netty-eventloopgroup.md].
It sits alongside related implementations such as DefaultEventLoopGroup^[600-developer-big-data-netty-netty-eventloopgroup.md].
Related Interfaces and Implementations¶
The architecture of NioEventLoopGroup relies on several key interfaces and classes that define execution behavior:
- EventExecutor: This interface is fundamental to the group's functionality^[600-developer-big-data-netty-netty-eventloopgroup.md]. Common implementations include:
SingleThreadEventExecutor^[600-developer-big-data-netty-netty-eventloopgroup.md]SingleThreadEventLoop^[600-developer-big-data-netty-netty-eventloopgroup.md]EmbeddedEventLoop^[600-developer-big-data-netty-netty-eventloopgroup.md]
- Executor: The underlying task execution model is based on the
java.util.concurrent.Executorfunctional interface^[600-developer-big-data-netty-netty-eventloopgroup.md].
Task Execution Model¶
The execution of tasks within an EventLoopGroup utilizes the standard Java concurrency utility Executor^[600-developer-big-data-netty-netty-eventloopgroup.md]. This interface allows for decoupling task submission from task execution mechanics, supporting various strategies such as:
- Direct Execution: Tasks run immediately in the caller's thread^[600-developer-big-data-netty-netty-eventloopgroup.md].
- Thread Per Task: A new thread is spawned for each task^[600-developer-big-data-netty-netty-eventloopgroup.md].
- Serial Execution: Tasks are queued and executed sequentially by a background executor^[600-developer-big-data-netty-netty-eventloopgroup.md].
Components¶
Alongside the core loop groups, the system utilizes supporting components for management and asynchronous results:
- RejectedExecutionHandlers: Used to handle tasks that cannot be accepted by the executor^[600-developer-big-data-netty-netty-eventloopgroup.md].
- DefaultPromise: Used for managing the results of asynchronous operations^[600-developer-big-data-netty-netty-eventloopgroup.md].
Related Concepts¶
- [[Netty]]
- [[Event Loop]]
- [[Concurrency]]
Sources¶
600-developer-big-data-netty-netty-eventloopgroup.md