Hi,

I think I am going to need to refactor the APR Poller code. Before I get
to far down that road I wanted to get a sanity check from those that
understand the APR/native connector better than I do.

The main problem:
- I need to be able to update the flags for a socket current in the
poller. For example, adding FLAGS_WRITE to a socket that currently has
FLAGS_READ

Side issues:
- APR connections don't track number of HTTP keep-alives left (it gets
reset every time the socket goes back to the Poller)
- Currently we have two completely separate sets of Pollers. Once for
Comet and one for non-Comet.

The reasoning for the refactoring:

1. Sockets should only be added to a pollset once.
2. Because of 1) to update the flags the socket needs to be removed from
the pollset and re-added with the new flags.
3. Currently, we have no record of which Poller a socket is registered
with. This makes 2) more expensive as we have to iterate through the
Pollers to find the socket. Tracking the current poller used by a socket
would make 2) a cheaper operation.
4. Implementing 3) requires maintaining a mapping from socket to
SocketWrapper (like KeyAttachment does in NIO)
5. A simple Map of Socket->SocketWrapper should give us what we need.

In addition to enabling me to continue with the Servlet 3.1 NIO work,
the other advantages to the proposed refactoring are:
- Will be able to eliminate the CometPollers since the SocketWrapper
knows if a request is Comet or not.
- Proper tracking of HTTP keep-alive requests left per connection.

If anyone can see a good reason not to start down this path, please
speak up.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to