Hi All I have a small tiff with a college at work regarding thread safety of helper classes .He believes that thread safety is inherent in helper classes since they are called form a thread safe contenxt I believe not.... This is my scenario
I have a stateless session bean calling a helper method to download a file and then unzip it.Is this thread safe I think not because if two stateless session beans try to access the same webservice at the same time and try tod wonload the file one may over write the other hence I put a time in nano seconds and thread id to distinguish it ..
So if I want to make seomthign thread safe I will need some kind of synchrnoized block in my code (helper) to make it thread safe ....
Also is it a good practise to pass the entitymanger from a sessionbean to a helper class.
posted 8 years ago
calling helper method is thread safe so longer the method is in the same bean class or object which contains the method is instantiated per request or is instance level variable in the bean class.