I think you don't have much choice but to synchronize. But synchronization should be applied sensibly on objects which shouldn't create bottlenecks for the application. The HttpSession object, ServletContext object and servlet instance variables needs are NOT thread safe and should be handled carefully.
You should avoid synchronising as much as possible - for example, unless you intend for multiple servlet invocations to share the same instance variable (which can happen with things like database Connections, although a pool is better), you should avoid instance variables. If you do use them, you should be careful with the synchronisation if your invocations of that instance are more than atomic operations. Generally I would advise trying to create a different construct in your design if you find yourself synchronising a lot (e.g. for database Connections use a factory or pool).
The only standard J2EE objects you should synchronise, if thread safety is a concern (and it isn't always), are HttpSession and ServletContext simply because these can be accessed by multiple servlets concurrently. However, if all your servlets only ever read data from these objects (i.e. don't use their scoped attributes), it is unnecessary to synchronise. For example, you wouldn't synchronise when obtaining context initialisation parameters because they are immutable after application start-up.
For these objects, if your ServletContext variable was called context, you would use:only in the places within the methods where you need to access the context. You shouldn't use synchronized methods in servlets - but they're fine of course in JavaBean helpers.
Oh, and never use the deprecated SingleThreadModel. [ May 10, 2006: Message edited by: Charles Lyons ]
Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / AmazonAmazon UK )
That would be nice to hear from you, sai prasanna, when people answer your questions. You're asking a lot, but never give any feedback. Just let us know that you've understood what the other ranchers have told you.