• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

thread safety of helpmer methods in ejb

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Cheers
Priya
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic