Thursday, April 12, 2007

Threads in EJBContainer - WorkManager

No Threads in EJBContainer:
Running threads in the EJBContianer context is an EJB Specification violation.

Possible Reasons:
EJBContainer provides various services like Object pooling, transaction and etc. If a thread is run in an EJB component the EJBContainer looses the control over the component instances as thread can block on an Object. This may create inconstant behavior of the server.

Solution: WorkManager – JSR 237

  • WorkManager is a joint specification from BEA & IBM to standardize the process of creating and managing container managed threads.
  • These threads are none other than the normal java thread with the only difference, the thread is created using JNDI reference and the lifecycle of the thread is managed by the container itself.
  • This specification is supported from Weblogic 9.X versions and IBM WebSphere Application Server 6.X.


Basic Components of WorkManager Implementation are,

  1. WorkManager
  2. Work
  3. WorkListener
  4. WorkItem
  5. RemoteWorkItem
  6. WorkEvent

Class Diagram


No comments: