Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpSessionListner in Clustered Environment  RSS feed

 
Rakesh Ramchandran
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a query with respect to HttpSessionListner in clustered environment.

Senerio: Let's say I have where the business requirement that only one session of the user should be active at anytime. If the session is active, and if the user tries to login from another browser or another system, the login should be not allowed.

Solution: The solution considered is that then the user logs in, the userid is stored in a static hashtable.
If the session expires, the user is removed from the hashtable using the sessionDestroy() using a class implementing HttpSessionListener. There is a penelty of 10 mins time if the user closes the browser by mistake without hitting the logout button [as the user id will still be stored in the hashtable].

Problem: The area of concern is the use of this approach in clustered environment.
i.e. in case of first login the user authorisation request is send to server 1 and in case of second login by the same user the authorization request is send to server 2.

So will the HttpSessionListener work in this case to track the userid stored in hashtable.

Thanks in advance for any reply provided.
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HttpSession will be same and will be migrated from one cluster to another, but not the HttpSessionListener, so a Hashtable as an instance variable of listener class wont work in this scenario. Why not store this data in a db?

Not sure of this but maybe we can even bind this Hashtable object to some namespace and lookup for it and use it.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Rakesh",
Please check your private messages.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!