Tomcat NioEndPoint Architecture
Tomcat NioEndPoint Architecture
As a web server, how Tomcat implements the I/O models to complete communicate. In Tomcat NioEndPoint, it implement the I/O Multiplexing Model.
What the I/O Multiplexing Model indicates us to do? Let's see the picture in the before blog.


I/O Mutliplexing Model Implemention in Java
What does the multiplexing means?
That is one Selector manages many Channels. In other word, many Channels share a common Selector.

In Java, we would follow a simlpe description in two steps to implement.
-
Create a Selector.
Create some Channels.
Register the Channels' interested thing (Connect, Accept, Read, Write, that's to say the Channel have four function) on Selector.
The Selector call
selectto start to work, to exam and wait the registered interesting thing coming in a loop. -
When the interesting thing comes, e.g. The
Readinteresting thing comes.We would create a new thread to
Readthe data from that Channel.
In Tomcat, the NioEndPoint implement in the way downside.



浙公网安备 33010602011771号