0 Replies Latest reply on Jul 21, 2009 6:02 AM by Rakesh Mistry

    Which ObjectInstance to reference cache?

    Rakesh Mistry Newbie

      Hi,

      I have managed to successfully start the JBoss Cache on a Glassfish server.

      I am now trying to get a handle to the cache object so I can write/read from it or shut it down.

      Unfortunately, when I look at the ObjectNames in the mbean server I find the following:

      [PPHCache]: jboss.cache:jmx-resource=CacheMgmtInterceptor,service=PPHCache
      [PPHCache]: jboss.cache:jmx-resource=MVCCLockManager,service=PPHCache
      [PPHCache]: jboss.cache:jmx-resource=RegionManager,service=PPHCache
      [PPHCache]: jboss.cache:jmx-resource=InterceptorChain,service=PPHCache
      [PPHCache]: jboss.cache:jmx-resource=TxInterceptor,service=PPHCache
      [PPHCache]: jboss.cache:jmx-resource=TransactionTable,service=PPHCache
      [PPHCache]: jboss.cache:jmx-resource=DataContainer,service=PPHCache
      [PPHCache]: jboss.cache:jmx-resource=RPCManager,service=PPHCache
      


      I created the cache with the following Object Name: jboss.cache:service=PPHCache
      So which ObjectName do I retrieve to access the cache object?

      Thanks
      Rax

      NB. Below is the code I use to create the cache (I included only the "essential" steps):
      String serviceName="jboss.cache:service=PPHCache";
      Cache cache=null;
      
      CacheFactory factory = new DefaultCacheFactory();
      System.out.println("[PPHCache]: About to create cache");
      cache = factory.createCache();
      
      System.out.println("[PPHCache]: Get Platform MBeanServer");
      
      MBeanServer server = ManagementFactory.getPlatformMBeanServer();
      ObjectName on = null;
      System.out.println("[PPHCache]: Try to create ObjectName");
      on = new ObjectName(serviceName);
      
      JmxRegistrationManager jmxManager = new JmxRegistrationManager(cache, on);
      jmxManager.registerAllMBeans();
      
      System.out.println("[PPHCache] Start the cache.");
      cache.create();
      cache.start();