Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ServletContext in a Clustered environment  RSS feed

ram nagab
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I read Marty Hall's SCWCD Exam review in SCWCD links in javaranch site

I read the following paragraph in page 15

� Presumably they mean "in a distributed Web app." The
point is that the servlet context and sessions are
guaranteed to be shared in a Web app running on a
distributed (clustered) server. But, listener instances have
no such guarantee, so they cannot store data in their
instance variables (fields). Same goes for instance
variables of servlets: not safe in distributed apps.

BUT AS I know that

In the case of a web application marked "distributed " in its deployment
descriptor, there will be one context instance for each virtual machine. In
this situation, the context cannot be used as a location to share global
information (because the information won 't be truly global). Use an external
resource like a database instead.

I think the sevlet context can not be shared in clustered environment

please correct me if I am mistaken ?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!