in clustering if there are 2 nodes each node is having own JVM(class loaders).each node load the same class then there will be two instances of any static vars for that class.
in clustering will i get problem If the same class is loaded by two different class loaders (2 nodes).
intially activeSessions=0 when user login we r incrementing.if same user login in thru another node should i get incremented sessionvalue.
public class SessionTracker implements HttpSessionListener {
private static int activeSessions = 0;
private Log logger = LogFactory.getLog("ex");
public void sessionCreated(HttpSessionEvent httpSessionEvent) {
logger.info(" Total sessions: " + ++activeSessions);
}
public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
String sessionTracker = (String) httpSessionEvent.getSession().getAttribute("tracker");
logger.info(" Total sessions: " + --activeSessions);
}
}