Using threads within Session beans

Discussions

EJB programming & troubleshooting: Using threads within Session beans

  1. Using threads within Session beans (2 messages)

    Hi,

    First a quote from the EJB 2.0 PFD 3 specification:

    "The enterprise bean must not attempt to manage threads. The enterprise bean must not attempt to start, stop, suspend, or resume a thread; or to change a thread's priority or name ..."


    Does this mean that if I call Session Bean A, it then calls class B (which is not an EJB) and class B kicks off a thread, then I have violated the EJB specification? I assume the answer is "yes" but I would like a second (or third or fourth ...) opinion.

    Cheers,
    Darren.
  2. The answer is yes, assuming that class B is not a part of a seperate J2EE component. If it is a seperate J2EE component, whether or not it can manipulate threads depends on it's own component type. For instance, if you talk to a Connector object, the Connector may manipulate threads to some extent: because the J2EE connector architecture allows it.

    Gal
  3. Short answer is yes. Unfortunately, all user managed threads must be kicked off before you hit the EJB layer.

    Fuji