wood burning stoves
The moose likes Servlets and the fly likes servlet's thread safe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet Watch "servlet New topic

servlet's thread safe

David Qiu

Joined: May 14, 2001
Posts: 8
i am doing a project which allows more than one person to access a servlet, which results in multiple servlet instances at the same time. and i think some objects may not be in a consistent way, they are servlet class variables, request attributes, session attributes and context attributes. is that right? do i need to synchronized these objects? thanks in advance
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Yes, you can either synchronize any access to those variables, or implement the "SingleThreadModel" interface.

So much trouble in the world -- Bob Marley
I agree. Here's the link: http://aspose.com/file-tools
subject: servlet's thread safe
jQuery in Action, 3rd edition