• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpSession object

 
Baskaran Ragav
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have read that session objects are stored and managed by the container( i mean in the heap of the JVM).

How ever in a distributed architecture where we have more than one container, will there be any common place where these objects are stored ?

Correct me if my understanding is wrong

Thanks Ragav
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, even in a distributed environment, there's a single session. The difference with non-distributed environments is that the session may be migrated from one JVM to another.
 
Baskaran Ragav
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Christophe Verre,

But how does this migration happens between JVM's Is it handled by the container itself ?

Any techniques or Please tell me the site where i can find more info on it.

Thanks,
Ragav,
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container will do the migration when it finds it necessary. Objects in the session must be Serializable. The container will notify session objects implementing HttpSessionActivationListener if any.
You can read more in the servlets specification (http://faq.javaranch.com/view?SpecificationUrls), SRV.7.7.2 Distributed Environments
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat's session replication offers you a few options.
Reading this page from the Tomcat documentation site may help.
http://tomcat.apache.org/tomcat-5.5-doc/cluster-howto.html

I'm sure most other containers have similar options.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!