• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scoped to JVM

 
Shivani Chandna
Ranch Hand
Posts: 380
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In MZ's notes:


"In distributed Web containers, HttpSession instances are scoped to the particular JVM servicing session requests, and the ServletContext object is scoped to the Web container's JVM."


Can someone elaborate the above statement. Its a little unclear to me.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's only one web container, but in a distributed environment, several JVMs.
A HttpSession maybe migrated from one JVM to another. That's why there is a HttpSessionActivationListener to notify you when this happens.
Context attributes are local to the JVM in which they were created, so a servlet running in JVM1 will not be able to access a context information initiated in JVM2.
 
Shivani Chandna
Ranch Hand
Posts: 380
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm.... You are talking of multiple JVM's within the container whereas the statement states talks of

"ServletContext object is scoped to the Web container's JVM. "

:roll:
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One application, but several JVMs. You need to understand first what a distributed environment is.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic