aspose file tools
The moose likes Servlets and the fly likes Session objects in Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Session objects in "redundant" environment" Watch "Session objects in "redundant" environment" New topic
Author

Session objects in "redundant" environment

Alan Franklin
Greenhorn

Joined: Jul 29, 2009
Posts: 2
I had a question in an interview recently where they asked something to the effect of - what things would you need to take into account when storing a session object in a "redundant" environment. First thought is to implement the serializable interface in case the session objects are passed between servers, stored to disc, etc... I'm thinking they were also looking for something about synchronizing the block of code that sets the session attribute. Any other thoughts on this? Do the 2 above assumptions make sense to do?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56185
    
  13

"Java UserNineNineNine", please check your private messages for an important administrative matter.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Himanshu Kansal
Ranch Hand

Joined: Jul 05, 2009
Posts: 257
Synchronized I guess it would automatically be being in a servlet.
Storing the state is a good option but Serialization might not help as the JVM restart will kill that. So writing to disc is an alternative.

Further more light can be thrown on it by some expert.

Regards


Experience and talent are independent of age
Alan Franklin
Greenhorn

Joined: Jul 29, 2009
Posts: 2
Just to be clear, I should've phrased it as "storing an object in the session scope in a redundant environment". So, you have a servlet that calls a business object and passes it the HttpSession object (yes, I know this is bad practice, but humor me for this exercise) and this business object creates some object say "Person" and sets this Person object in the session scope.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Session objects in "redundant" environment
 
Similar Threads
set references to null in finalize method?
Cause of memory leaks in Tomcat
Question regarding Session Migration
java beans and serialized beans
HttpSessionBindingListener Interface