3 Replies Latest reply on May 15, 2007 3:21 PM by brian.stansberry

    Can't control (Tree)Cache via JConsole

    edgenuity

      I'm using JDK 1.6, and JBossCache 2.0.0 (BETA).
      I create a TreeCache, run it, test it, with no problem.
      I put a listener to track changes to the (Tree) cache.
      I registered the cache with the MBeanServer. No problem.

      I brought up JConsole and I see my test program.
      I try to invoke the Start/Stop methods exposed via the JConsole, I get feedback on the success when I invoke them (press the button), but my listener never gets invoked.

      Any ideas, where I can start? I need to able to control the cache remotely.

        • 1. Re: Can't control (Tree)Cache via JConsole
          brian.stansberry

          How are you registering the cache with the MBeanServer?

          • 2. Re: Can't control (Tree)Cache via JConsole
            edgenuity

            Excerpt from my code below.

            mBeanServer = ManagementFactory.getPlatformMBeanServer();
            Configuration config = new Configuration();
            config.setClusterName("CacheTest");
            config.setExposeManagementStatistics(true);
            config.setCacheMode(Configuration.CacheMode.LOCAL);
            myCache = DefaultCacheFactory.getInstance().createCache(config);
            myCache.addCacheListener(myCacheListener);
            mBeanNameStr = JmxUtil.PREFIX +
            myCache.getConfiguration().getClusterName();
            JmxUtil.registerCacheMBean(
            mBeanServer, new CacheJmxWrapper(myCache), mBeanNameStr);
            ObjectName mBeanName = new ObjectName(mBeanNameStr);
            if (mBeanServer.isRegistered(mBeanName))
            System.out.println ("MBean Registered:"+mBeanNameStr);
            else
            System.out.println ("MBean not registered");

            • 3. Re: Can't control (Tree)Cache via JConsole
              brian.stansberry

              You are hitting the issue discussed at http://jira.jboss.com/jira/browse/JBCACHE-1047. If you were using code built from the latest HEAD you could:

              ...
              CacheJmxWrapper wrapper = new CacheJmxWrapper(myCache);
              wrapper.setManageCacheLifecycle(true);
              JmxUtil.registerCacheMBean(mBeanServer, wrapper, mBeanNameStr);
              ...


              This thread though makes me realize that that's still pretty broken, although it should work fine for your use case. See http://jira.jboss.com/jira/browse/JBCACHE-1058 for how discussion of how it's still broken.