This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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


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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: if same user login in thru another node should i get incremented sessionvalue
 
It's not a secret anymore!