}
private void registerQueryMBeans(AdvancedCache cache,
ComponentRegistry cr, String cacheName) {
Configuration cfg = cache.getCacheConfiguration();
SearchFactoryIntegrator sf = getSearchFactory(
cfg.indexing().properties(), cr, null);
// Resolve MBean server instance
GlobalConfiguration globalCfg =
cr.getGlobalComponentRegistry().getGlobalConfiguration();
mbeanServer = JmxUtil.lookupMBeanServer(globalCfg);
// Resolve jmx domain to use for query mbeans
String queryGroupName = getQueryGroupName(cacheName);
jmxDomain = JmxUtil.buildJmxDomain(globalCfg, mbeanServer, queryGroupName);
// Register statistics MBean, but only enable if Infinispan config says so
Statistics stats = sf.getStatistics();
stats.setStatisticsEnabled(cfg.jmxStatistics().enabled());
try {
ObjectName statsObjName = new ObjectName(
jmxDomain + ":" + queryGroupName + ",component=Statistics");
JmxUtil.registerMBean(new StatisticsInfo(stats), statsObjName, mbeanServer);