2 Replies Latest reply on Jul 18, 2004 4:58 AM by aburton

    Getting started with JTreeCache as MBean and JBoss 3.2.5

    aburton

      Can anyone give me any pointers on how to get started with JTreeCache used as a MBean in JBoss 3.2.5.

      I have deployed a SAR with the jboss-service.xml from the example on the tutorial

      <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=TreeCache">
      <depends>jboss:service=Naming</depends>
      <depends>jboss:service=TransactionManager</depends>
      ... etc...
      


      So once I've done this... how do I look up the Cache?

      A little background into what I am trying to achieve...

      I wish to use it as a temporary data store shared between Stateless Session Beans that drop some actions on a JMS Queue and Message Driven Beans that are asynchronously working on the queue and placing the results into the Tree Cache so the results can be polled for. I have no database to store the data.

      Many thanks,
      Alex.

        • 1. Re: Getting started with JTreeCache as MBean and JBoss 3.2.5
          prese

          Hi Alex,

          If you want to used it inside the same JMV you can use MBeanServerLocator.locate() to locate the MBeanServer. After this you can use MBeanProxy.get(TreeCacheMBean.class, new ObjectName("jboss.cache:service=TreeCache"), MBeanServer server) to retrieve an instance to TreeCacheMBean.

          If you want to access it from a different JVM you can try it via RMIAdaptor.

          HTH
          Sebi

          • 2. Re: Getting started with JTreeCache as MBean and JBoss 3.2.5
            aburton

            Many thanks, worked a treat :)

            Alex.

             public static org.jboss.cache.TreeCacheMBean getTreeCache() throws
             javax.management.MalformedObjectNameException,
             org.jboss.mx.util.MBeanProxyCreationException
             {
             MBeanServer mbServer = MBeanServerLocator.locate();
             return (TreeCacheMBean)MBeanProxy.get(TreeCacheMBean.class, new ObjectName("jboss.cache:service=TreeCache"), mbServer);
             }