• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Threading in Containers  RSS feed

Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI guys,

I have some thread safety concerns about EJB, JSP, servlets in their respective containers. I mistakenly posted it at the below forum:


Any responses will be much appreciated!
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the other thread, that probably oughtta be closed ...

Yes, I am concerned about thread-safety as provided by the container, and when does the developer need to create threads themselves and take care of threading.

So is it correct to say that EJBs should be coded for a single thread and the container will manage/create multiple threads as required?

The 2nd paragraph is right on - the container does a lot of nifty stuff with threads, so the answer to the 1st paragraph is we should not do anything with threads. The container wants to manage threads entirely and if we go about creating them and locking them it can't do its job as well. The EJB spec and maybe the Servlet spec (I'd have to look on that one) tell you not to create threads.

Because that's rather restrictive, some container vendors have added some non-standard way to work with threads. I remember reading up on one in WebSphere but never used it. JMS queuing is another standard way to spawn an asynchronous task.

I've broken the rules in the past with a limited amount of very carefully controlled thread work, and gotten away with it so far.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!