• 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

Concurrency in J2EE Container

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am charged with refactoring a J2EE application (WebLogic 10) and have come across code that creates threads (extend java.lang.Thread). I seem to remember from my early reading on J2EE that it is bad practice to spawn your own threads in a J2EE container, and also that there are better ways of achieving concurrency.

Question 1: Why are threads in a container problematic and what kind of problems can they cause?

Question 2: What are the best practices for achieving concurrency?
 
Ranch Hand
Posts: 1491
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please check java.util.concurrent package API methods.
 
Stephen Watson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.util.concurrent is precisly what the J2EE practices advise against because new threads will be outside the control of the container. Thus my question.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What type of container do you mean when you say "J2EE" container? An EJB container? The specification explicitly mandates you should never spawn threads from an EJB. A Servlet container is a different matter.
 
reply
    Bookmark Topic Watch Topic
  • New Topic