4 Replies Latest reply on Jul 25, 2005 7:56 AM by xavierpayne2

    Is JBossCache good inside EJB model?

    joise joise Newbie

      Hello everyone,
      i'm asking myself if using JBossCache inside a EJB container is correct according with EJB especification which avoid the creation of threads, static variables and so one.
      ¿what kind of problems could appears?
      ¿Why is able to be used inside a container?
      ¿is it a good idea create a connection driver complaint with ejb spec?

      I read the forum menssages before but i'm very confused about responses.

      Thanks a lot.

        • 1. Re: Is JBossCache good inside EJB model?
          joise joise Newbie

          I'm going to explain the issue I am confused about :

          The problem with the restrictions in ejb is related to instance TreeCache directly inside the ejb, because TreeCache is a socket listener, thread creator what is forbidden in the ejb especification restrictions.
          You have to get the TreeCache reference through JNDI and everything works fine.
          Another posibility is the use of jmx to make the reference to the MBean TreeCache, in both cases the creation of TreeCache is not "placed" in the ejb thread but in JBoss.

          I did not realize about the problem at that moment.

          • 2. Re: Is JBossCache good inside EJB model?

            If you run TreeCache inside JBoss, the best way is always looking it up through MBean service.


            • 3. Re: Is JBossCache good inside EJB model?
              joise joise Newbie

              Only one more question:
              Is this TreeCache MBean called by reference inside ejb?
              I mean if we can't use threads control and TreeCache take control of ejb thread (for example in transactions locks)...are we breaking the ejb specs?

              • 4. Re: Is JBossCache good inside EJB model?
                xavierpayne2 Newbie

                If you look it up through the MBean Service and use whats passed back by that then yeah. It's basically a pass by reference. So its no different (to your ejb) than doing a remote or local lookup of an ejb.

                We have ejbs use MBeans all the time. The only time you need to be careful is when you get them tangled up... Like for example having an EJB call an entity bean which calls a service which calls the same entity bean... Stuff like that is a problem.

                In short EJB -> MBean = fine. Spec is preserved.