Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

When is a new thread created for a MDB  RSS feed

 
Mahesh Trikannad
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When is a new thread created for a MDB, is it at ejbCreate or is it at onMessage.

I wrote a utility to map threads to some contexts. I was setting the thread at ejbCreate and trying to retrieve it on onMessage. Suspect the two threads are different. ejbCreate always shows me thread name of main

Regards

Mahesh
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Threads are not bound to MDBs and other EJBs. Instead, MDBs and session beans are created in pools and left idle until needed. When a request is to be processed, a thread is grabbed from the container's thread pool and given a bean to perform the operation. Once complete, both thread and bean return to their respective pools.

THus the thread(s) that create(s) beans and the ones that use them will likely be different.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!