File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes if same  user login in thru another node  should i get incremented sessionvalue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "if same  user login in thru another node  should i get incremented sessionvalue" Watch "if same  user login in thru another node  should i get incremented sessionvalue" New topic
Author

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

maha laxmi
Ranch Hand

Joined: Sep 23, 2005
Posts: 68
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

Joined: Aug 15, 2004
Posts: 2874
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: if same user login in thru another node should i get incremented sessionvalue