[jboss-user] [JBoss Seam] - How to reliably count active sessions and connected users ?

gaboo do-not-reply at jboss.com
Fri Jan 18 09:54:16 EST 2008


Hello.

I'm using seam 2.0.0 and I'd like to cound the active sessions and connected users.

For session, I'm using two observer methods in an application scoped ejb to count : 

@Observer("org.jboss.seam.postCreate.org.jboss.seam.web.session")
  | public void increaseUserCount() {
  | 	userCount++;
  | }
  | 
  | @Observer("org.jboss.seam.preDestroyContext.SESSION")
  | public void decreaseUserCount() {
  | 	userCount--;
  | }

For connected users, I use those two seam security events : 

@Observer("org.jboss.seam.security.loginSuccessful")
  | public void increaseConnectedUserCount() {
  | 	connectedUserCount++;
  | }
  | 
  | @Observer("org.jboss.seam.security.loggedOut")
  | public void decreaseConnectedUserCount() {
  | 	connectedUserCount--;
  | }

Both solutions aren't ok. For example, sometimes I have a number of -1 for connected users. And for sessions, the number keeps high, so I don't know If a really catch all session ending.

Do you have / know a better idea ?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121298#4121298

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121298



More information about the jboss-user mailing list