I am studying the Netty 4.0.0.Alpha5 code in order to find out how threading is handled. I also read the introduction to the new threading model of Netty 4 at http://netty.io/wiki/new-and-noteworthy-in-4.0.html#wiki-h2-34.
As I understand it, the goals are:
So, I am wondering whether my interpretation is right or not. And if I am right, then the following question arises:
I am just trying to understand why the things are the way they are and to get some information about the design intentions of Netty 4.
EventLoop. A Netty EventLoop is a loop that keeps looking for new events, e.g. incoming data from network sockets (from SocketChannel) instances). When an event occurs, the event is passed on to the appropriate event handler, for instance a ChannelHandler .
At its core, Netty is a Java library that facilitates network operations. It supports both blocking and non-blocking I/O, connection-oriented protocols such as TCP as well as connectionless protocols such as UDP, and managing data transfer on both the client and the server.
True to the both question. By assigning a handler to a non-I/O event group, you can prevent an I/O thread from getting blocked by long running operations such as database access. You can specify an EventExecutorGroup
with large size depending on what the handler does. It's not very different from what usual thread pool does. If thread pool is busy, any attempt to execute a long running task will be queued.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With