I need to add some monitoring into my j2ee application and I need to monitor the TCP/IP connections. I'm wondering if there is a way to extend Tomcat so that I can take a timestamp on an incoming connection (also when that connection closes) and call a custom java class that uses this information (e.g. to keep track of this information).
At this point we only know on the servlet when we have an incoming request (and when we send the response), but we can't have a hold on the socket itself to have details on the connection as this is under control of the servlet container. Depending on how the client is behaving we can have one connection per request/response or we could have one connection handling multiple request/responses sequentially... so we can never be sure of the underlying connection(s).
Note that we are using tomcat 4.1 embedded in jboss 3.0.6.