As far as I know... > From: Thangavel Sankaranarayanan [mailto:[EMAIL PROTECTED] > Does Synchronization is taken care by Tomcat itself when i > call a static method from a thread
No. > should i use synchronized keyword Depends. If your application will fail under some circumstances if the call is not synchronised, then you should synchronise it. You are the only person who knows the detail of your application; nobody on this list can answer this question for you. > And J2EE application are multithread,so its container > responsibilities to handle all these stuff for user. No. The container can do some things, but it does not inspect your code for calls to static methods and synchronise them. > Even if you use 'synchronized' keyowrd in J2EE application > than you are > trying to make your container life tuff ....which you shd not > be the case. Depends. Large synchronised areas may lead to lock contention and hence slow down your application. In the extreme case, they could lead to deadlock. It's up to you to design your application appropriately, mainly by avoiding shared state as far as possible. It's not the container's job to get you out of the mess if you code your own solution. > Conatiner will do better handling of common resource,so we shd not use > 'synchronized' keyword. Yes, where the container is aware of the common resource and knows how to pool it. No, where it's your own code implementing the common resource. - Peter --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]