1 Reply Latest reply on Apr 16, 2003 7:18 AM by Adrian Brock

    EJB and Threads

    Richard Shea Newbie

      I have never understood to my satisfaction what the EJB requirement that EJB's cannot create Threads means, and am hoping someone can clarify.

      For instance, is it legal to provide a service within JBoss as an MBean that is registers an object with JNDI that an EJB can look up and invoke where the implementation of a method of the JNDI-registered object spawns a Thread?

      If this is legal, then what is the demarcation point for where Threads can be created or not within the context of a call into an EJB?

      Thanks in advance,
      - Rich

        • 1. Re: EJB and Threads
          Adrian Brock Master

          There are two points to not creating threads.

          1) The server loses control of what threads
          are created and how they are synchronized
          2) Things like the security and transaction
          are attached to the thread.

          If you write an MBean you become part of
          the server. It is upto you to consider the
          above constraints and play fair.

          Regards,
          Adrian