File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Making context attribute thread safe... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Making context attribute thread safe..." Watch "Making context attribute thread safe..." New topic

Making context attribute thread safe...

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
What I got from reading HFS&J is, There is only one way to make context attribute thread safe, where ever we are using context (setting and getting attrubute in context) in whole web application, do that in synchronized block. Other than this, there is no way to make sure...

Am I right?

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Yes you are right.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

This topic is currently being discussed here as well:

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Thanks Pradip and Ben.
jQuery in Action, 2nd edition
subject: Making context attribute thread safe...
Similar Threads
ServletContext.setAttribute() always need Synchronization
request atributes are always thread-safe?
Thread safe Session, Context and Request?
Context Attributes are not thread safe??
Context attributes thread safe or not?