tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Südkamp <>
Subject Problem with session counting
Date Mon, 30 Aug 2004 13:24:27 GMT

I have problems tracking the lifecycle of my sessions. I use the session listener code below.
I test my app with Apache JMeter and run a test with 10 threads for about 3 minutes.
Then I stop the test and let the sessions time out (session timeout is set to 5 min)

Almost everytime the session counter is greater than 0 when I expect it to be 0.
My logs show that my session count during the test goes beyond the expected 10 sessions (it
rises to 13-16 sessions depending on the test duration).

The Tomcat manager reports 10 sessions during the test and 0 sessions after all sessions have
timesd out.

Is there anything wrong I can do with my sessions so that the created and destroyed sessions
are not balanced?



public class SimpleSessionListener implements HttpSessionListener {

  private static int sessionCount = 0;

  public void sessionCreated(HttpSessionEvent event) {
    System.out.println("sessionCreated: sessionCount="+sessionCount);

  public void sessionDestroyed(HttpSessionEvent event) {
    System.out.println("sessionDestroyed: sessionCount="+sessionCount);


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

View raw message