Re: How can I count the number of active requests/servlets for Tomcat?

2004-01-15 Thread Christopher Schultz
Tom,

I'm running a web service using Axis with Tomcat.  How can I count 
the number of active requests?
I think you want to use a Filter for your requests:

public class ConnectionCounter
implements javax.servlet.Filter
{
private int _activeConnections = 0;
public void init(FilterConfig fc) { }
public void destroy() { }
public doFilter(ServletRequest req,
ServletResponse rsp,
FilterChain fc)
throws ServletException, IOException
{
synchronized(this) {
++_activeConnections;
}
		fc.doFilter();

synchronized(this) {
--_activeConnections;
}
}
public int getActiveConnectionCount()
{
// Need not be synchronized, int access is atomic
return _activeConnections;
}
}
Of course, you'll need to get a reference to your filter in order to
read the connection count, but that is an exercise left to the reader :)
I used the HttpListener interace but the sessionDestroyed method
doesn't seem to get called until 5 minutes after the servlet ends.
Ouch. You have web services that use sessions? You should probably turn 
off http sessions for those...

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How can I count the number of active requests/servlets for Tomcat?

2004-01-15 Thread Filip Hanik
or use a filter or a valve,
and register the request when it enters, and deregister it when it
completes.
that way you can track how many are active at any given time

Filip
- Original Message -
From: "James Black" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
Sent: Thursday, January 15, 2004 3:45 PM
Subject: RE: How can I count the number of active requests/servlets for
Tomcat?


> Write each request into a table with the session id?
>
> " Work like you don't need the money, love like you've never been hurt,
and
> dance like no one is watching."
> --- Satchel Paige
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How can I count the number of active requests/servlets for Tomcat?

2004-01-15 Thread James Black
Write each request into a table with the session id?

" Work like you don't need the money, love like you've never been hurt, and
dance like no one is watching." 
--- Satchel Paige 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How can I count the number of active requests/servlets for Tomcat 4.1.29?

2004-01-15 Thread Tom Ly
i'm using tomcat 4.1.29

Tom Ly <[EMAIL PROTECTED]> wrote:I'm running a web service using Axis with Tomcat. How 
can I count the number of active requests? I used the HttpListener interace but the 
sessionDestroyed method doesn't seem to get called until 5 minutes after the servlet 
ends.


-
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes


-
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes

How can I count the number of active requests/servlets for Tomcat?

2004-01-15 Thread Tom Ly
I'm running a web service using Axis with Tomcat.  How can I count the number of 
active requests?  I used the HttpListener interace but the sessionDestroyed method 
doesn't seem to get called until 5 minutes after the servlet ends.


-
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes