-
1. Re: Can't control (Tree)Cache via JConsole
brian.stansberry May 15, 2007 2:24 PM (in response to edgenuity)How are you registering the cache with the MBeanServer?
-
2. Re: Can't control (Tree)Cache via JConsole
edgenuity May 15, 2007 2:33 PM (in response to 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 May 15, 2007 3:21 PM (in response to edgenuity)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.