tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <>
Subject Tomcat Native example
Date Sat, 05 Feb 2005 12:59:24 GMT
To whom it may concern:

I've committed the example for Tomcat Native that acts
as simple Echo server.
Well, it does not echo anything, but that's not the point.

Here is how it works.
It creates two threads 'Acceptor' and 'Poller'.
The Acceptor is standard blocking acceptor that waits for
any new connection.
When the connection arrives it launches a new 'Worker' thread
that reads the input in standard blocking mode.
When the Workers finds the LF char, it treats this
as end-of-transaction (like HTTP request with keep-alive).
It does not close the client connection, but rather
passes the socket to the 'Poller'.
The Poller then waits for the first byte received on that
socket, thus offering the non-blocking keep-alive.
When the event occurs the Poller launches the Worker with
already connected socket (like next keep-alive request).

That's about it.
Although being only the proof of concept it shows that
both BIO and NIO models can be combined together, thus offering
much greater scalability, without NIO's event latency.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message