wood burning stoves 2.0
The moose likes Servlets and the fly likes Session object in cluster environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session object in cluster environment" Watch "Session object in cluster environment" New topic

Session object in cluster environment

Naeva Darley

Joined: Jan 17, 2006
Posts: 2
The problem scenario is:
In a cluster environment, an object is saved in session by one node, and then one of that saved object's attribute is updated as follows:
1. session.setAttribute(ObjectName, value);
2. ObjectName sessObject = (ObjectName)session.getAttribute(ObjectName);
3. sessObject.updateAttribute1(); //which updates attribute1 of sessObject
Then the failover scenario occurs where the request is sent to the other node. Now, we don't see the updated attribute of the saved session object when the 2nd node tries to process it.

My question is, do we need to explicitly set the object in session again every time there is an attribute change? I mean, do we need to have the following setAttribute line everytime we update any attribute of that object to keep the session object up to date?
session.setAttribute(ObjectName, value);
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Welcome to JavaRanch!

We're pleased to have you here with us in the Servlets forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link: http://aspose.com/file-tools
subject: Session object in cluster environment
It's not a secret anymore!