@Test public void testCacheCreated() throws Exception { String name = getClass().getName() + ".testCacheCreated"; Cache c = Cache2kBuilder.of(Object.class, Object.class) .name(name) .eternal(true) .enableJmx(true) .build(); MBeanInfo i = getCacheInfo(name); assertEquals(CacheMXBeanImpl.class.getName(), i.getClassName()); c.close(); }
@Override public void cacheCreated(Cache c, Cache2kConfiguration cfg) { if (MANAGEMENT_UNAVAILABLE || !cfg.isEnableJmx() || cfg.isDisableMonitoring()) { return; } MBeanServer mbs = getPlatformMBeanServer(); String name = standardName(c.getCacheManager(), c); try { mbs.registerMBean(c.getStatistics(), new ObjectName(name)); } catch (InstanceAlreadyExistsException existing) { log.debug("register failure, cache: " + c.getName(), existing); } catch (Exception e) { throw new CacheException("register JMX bean, ObjectName: " + name, e); } }
JmxSupport implements CacheLifeCycleListener, CacheManagerLifeCycleListener { @Override public void cacheCreated(Cache c, Cache2kConfiguration cfg) { if (MANAGEMENT_UNAVAILABLE || !cfg.isEnableJmx() || cfg.isDisableMonitoring()) { return; } MBeanServer mbs = getPlatformMBeanServer(); String name = standardName(c.getCacheManager(), c); try { mbs.registerMBean(c.getStatistics(), new ObjectName(name)); } catch (InstanceAlreadyExistsException existing) { log.debug("register failure, cache: " + c.getName(), existing); } catch (Exception e) { throw new CacheException("register JMX bean, ObjectName: " + name, e); } } }
JmxSupport implements CacheLifeCycleListener, CacheManagerLifeCycleListener { @Override public void cacheCreated(Cache c, Cache2kConfiguration cfg) { if (MANAGEMENT_UNAVAILABLE || !cfg.isEnableJmx() || cfg.isDisableMonitoring()) { return; } MBeanServer mbs = getPlatformMBeanServer(); String name = standardName(c.getCacheManager(), c); try { mbs.registerMBean(c.getStatistics(), new ObjectName(name)); } catch (InstanceAlreadyExistsException existing) { log.debug("register failure, cache: " + c.getName(), existing); } catch (Exception e) { throw new CacheException("register JMX bean, ObjectName: " + name, e); } }  }
JmxSupport implements CacheLifeCycleListener, CacheManagerLifeCycleListener { @Override public void cacheCreated(Cache c, Cache2kConfiguration cfg) { if (MANAGEMENT_UNAVAILABLE || !cfg.isEnableJmx() || cfg.isDisableMonitoring()) { return; } MBeanServer mbs = getPlatformMBeanServer(); String name = standardName(c.getCacheManager(), c); try { mbs.registerMBean(c.getStatistics(), new ObjectName(name)); } catch (InstanceAlreadyExistsException existing) { log.debug("register failure, cache: " + c.getName(), existing); } catch (Exception e) { throw new CacheException("register JMX bean, ObjectName: " + name, e); } }  @Override void cacheCreated(Cache c, Cache2kConfiguration cfg); @Override void cacheDestroyed(Cache c); @Override void managerCreated(CacheManager m); @Override void managerDestroyed(CacheManager m); }
JmxSupport implements CacheLifeCycleListener, CacheManagerLifeCycleListener { @Override public void cacheCreated(Cache c, Cache2kConfiguration cfg) { if (MANAGEMENT_UNAVAILABLE || !cfg.isEnableJmx() || cfg.isDisableMonitoring()) { return; } MBeanServer mbs = getPlatformMBeanServer(); String name = standardName(c.getCacheManager(), c); try { mbs.registerMBean(c.getStatistics(), new ObjectName(name)); } catch (InstanceAlreadyExistsException existing) { log.debug("register failure, cache: " + c.getName(), existing); } catch (Exception e) { throw new CacheException("register JMX bean, ObjectName: " + name, e); } }  @Override void cacheCreated(Cache c, Cache2kConfiguration cfg); @Override void cacheDestroyed(Cache c); @Override void managerCreated(CacheManager m); @Override void managerDestroyed(CacheManager m);  }