• Post Reply Bookmark Topic Watch Topic
  • New Topic

J2EE and threads

 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have heard that you cannot (or should not) spawn your own threads when using EJBs. I don't use EJBs but I have also heard that you should not spawn your own threads when using J2EE. Is that true? We should let the container manage threads? If so, then how would one accomplish writing a multi-threaded app? Thanks
 
Henry Wong
author
Sheriff
Posts: 22516
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andy Hahn wrote:So I have heard that you cannot (or should not) spawn your own threads when using EJBs. I don't use EJBs but I have also heard that you should not spawn your own threads when using J2EE. Is that true? We should let the container manage threads? If so, then how would one accomplish writing a multi-threaded app? Thanks


In theory, you should not start any threads in J2EE. In practice, I see this all the time, particularly in servlets.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!