Xpages - Get number of active sessions
Posted
by
Jairo
on Stack Overflow
See other posts from Stack Overflow
or by Jairo
Published on 2012-06-24T13:25:55Z
Indexed on
2012/06/24
15:16 UTC
Read the original article
Hit count: 450
How do I get the number of active sessions in Xpage. I'm trying to use managed beans but it just returns a weird string. Here's the simple code:
import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; public class SessionCounterListener implements HttpSessionListener { private static int totalActiveSessions; public static int getTotalActiveSessions(){ return totalActiveSessions | 0; } public void sessionCreated(HttpSessionEvent arg0) { totalActiveSessions++; System.out.println("sessionCreated - add one session into counter"); } public void sessionDestroyed(HttpSessionEvent arg0) { totalActiveSessions--; System.out.println("sessionDestroyed - deduct one session from counter"); } }
I got this from here. But when I call SessionCounterListener.getTotalActiveSessions()
, it only returns a weird string, example com.gs3.beans.SessionCounterListener@46c446c4
. Please help me. Thanks a lot!
© Stack Overflow or respective owner