You may want to implement your own HTTPSessionListener for your servlet. It
looks something like this:
package mypackage;
import javax.servlet.http.HttpSessionListener;
import javax.servlet.http.HttpSessionEvent;
public class SessionListener implements HttpSessionListener {
static int activeSessions = 0;
static int maxActiveSessions = 0;
/** Session Creation Event */
public void sessionCreated( HttpSessionEvent se) {
synchronized (this) {
activeSessions++;
if (activeSessions > maxActiveSessions) {
maxActiveSessions = activeSessions;
}
}
}
/** Session Invalidation Event */
public void sessionDestroyed( HttpSessionEvent se) {
synchronized(this) {
if(activeSessions > 0) {
activeSessions--;
}
}
}
/** get the number of currently active HTTP sessions */
public static int getActiveSessions() {
return activeSessions;
}
/** get the maximum active concurrent HTTP sessions used so far */
public static int getMaxActiveSessions() {
return maxActiveSessions;
}
}
In your web.xml, add the following lines to make sure Tomcat sends the
events to your session listener during runtime:
<!-- Listeners -->
<listener>
<listener-class>mypackage.SessionListener</listener-class>
</listener>
Hope this helps.
J.Neuhoff
Kristian Rink wrote:
>
>
> Folks;
>
> does anyone know of any tomcat tool to watch HTTP sessions which
> are active in any deployed web application (and, best case, data
> assigned to them, aside the session ID itself)? I thought /manager
> or /admin to provide functionality like this but so far I failed to
> find it...
>
> Thanks in advance and bye,
> Kristian
>
>
> --
> Kristian Rink * http://zimmer428.net * http://flickr.com/photos/z428/
> jab: [EMAIL PROTECTED] * icq: 48874445 * fon: ++49 176 2447 2771
> "One dreaming alone, it will be only a dream; many dreaming together
> is the beginning of a new reality." (Hundertwasser)
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: [email protected]
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Session-Monitoring-tool--tf3025864.html#a8489437
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]