I am having issues with a SessionListener I have written. The purpose of the Listener is to maintain a List of Active Users on the site. Here is the code for the Listener.


// BEGIN CODE

public class ActiveUsersListener implements Serializable, HttpSessionListener {

public static Set activeSessions = new HashSet();

public void sessionCreated(HttpSessionEvent event) {
activeSessions.add(event.getSession());
}

public void sessionDestroyed(HttpSessionEvent event) {
activeSessions.remove(event.getSession());
}

public static List getActiveUsers() {
List users = new ArrayList();
Iterator sessionIter = activeSessions.iterator();
HttpSession session = null;
EmoUser user = null;
while (sessionIter.hasNext()) {
  session = (HttpSession) sessionIter.next();
  user = (EmoUser) session.getAttribute(EmoUser.SESSION_KEY);
  if (user != null & user.hasLoggedIn()) {
    users.add(user);
  }
}
return users;
}

}

// END CODE

I then have a webpage that calls ActiveUsersListener.getActiveUsers() to list out all the active users on the site. Note: I don't just store the User objects because the user object doesn't get created until the user logs in.

So the problem I am having is that this code works fine on a single box under Tomcat 5.5.4 . However, as soon as we go into a cluster we get lockups in Tomcat. The server is completely unresponsive, and there are no log/error messages.

Because of this I am assuming we have a concurrency issue, however I have no idea where the problem is.

A few more bits of information, we persist sessions to file system on shut down, and we use in memory session replication only when session.setAttribute() is called (DirtyFlag).

Thank you in advance for any help.

Jacob Champlin
EMO Corporation

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



Reply via email to