aspose file tools*
The moose likes Servlets and the fly likes Thread Safety question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Thread Safety question" Watch "Thread Safety question" New topic
Author

Thread Safety question

James Dekker
Ranch Hand

Joined: Dec 09, 2006
Posts: 215
What mechanism determines a servlet's thread safety? Is it the container or the implementation of the servlet class?

Thanks again!
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

An implementation of servlet classes.


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you're not sure how to create a thread safe servlet, follow this basic rule of thumb:
Don't create instance variables.

You could still run into concurrency issues if your servlets or JSPs try to access a session or context scope object at the same time but instance variables are the leading cause of threading problems in servlet applications.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
 
subject: Thread Safety question