Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ServletContext over distributed JVMs  RSS feed

 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, so I understand that there is one ServletContext per application per VM. Now, lets take a clustered environment where the Container does some type of load balancing.

The web app exists in multiple places (one in each VM in the cluster). So the ServletContext (and each ServletConfig for that matter) is duplicated across all VMs. So far so good. But what happens when a servlet in VM #1 adds or modifies a context attribute? Is this change perpetuated to all of instances of the ServletContext that exist in other VMs? I would assume so, because otherwise the concept of an application wide context breaks down, but I just want to be sure.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat has session replication but nothing for ServletContext.
If you need to use the context for application scoped vars, you would have to write something your self (JMS?).

I don't know about other containers.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!