• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

if same user login in thru another node should i get incremented sessionvalue

 
maha laxmi
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
}
}
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by maha laxmi maha laxmi:
if same user login in thru another node should i get incremented sessionvalue.


It depends on your requirements.
I would say yes. Otherwise dont let him/her log in.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic