Hi, You are 100% right. As per the EJB spec 'synchronized' shd not be used,and the reason is very simple,as you must be knowing that 'synchronized' keyword is used to avoid sharing conflict of a common resource in multi-threaded env. And J2EE application are multithread,so its container responsibilities to handle all these stuff for user. 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. Conatiner will do better handling of common resource,so we shd not use 'synchronized' keyword. hope that this will help you.
Cheers, Sunil Dixit [ July 05, 2007: Message edited by: Sunil Dixit ]
I don't agree with Kyle quotes,if that is true than we can do I/O in EJB using some helper class right ?
Yes, under certain circumstances. Don't get confused between can and should. For example, a helper class called from a session bean that preforms IO should be OK, presuming you can tolerate the non-transactional nature of file system IO, you don't deploy your EJB in a distributed environment, and you don't do any OS specific IO. You will also be undermining your security model, and changes to admin privileges on the host OS will have to be handled carefully, but this may be acceptable. For the reasons above it's not a smart thing to do, following the specification means you will stear clear of any such issues. [ July 09, 2007: Message edited by: Paul Sturrock ]