• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
}
}
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
What's that smell? Hey, sniff this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic