/** * Registers all JMX {@link MXBean MXBeans} from {@link OperationalStats} extensions in the extensions directory. */ @Override protected void startUp() throws Exception { runThread = Thread.currentThread(); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); for (Map.Entry<OperationalExtensionId, OperationalStats> entry : operationalStatsLoader.getAll().entrySet()) { OperationalStats operationalStats = entry.getValue(); ObjectName objectName = getObjectName(operationalStats); if (objectName == null) { LOG.warn("Found an operational extension with null service name and stat type - {}. Ignoring this extension.", OperationalStats.class.getName()); continue; } LOG.debug("Registering operational extension: {}; extension id: {}", operationalStats, entry.getKey()); // initialize operational stats operationalStats.initialize(injector); // register MBean mbs.registerMBean(operationalStats, objectName); } LOG.info("Successfully started Operational Stats Service..."); }
/** * Registers all JMX {@link MXBean MXBeans} from {@link OperationalStats} extensions in the extensions directory. */ @Override protected void startUp() throws Exception { runThread = Thread.currentThread(); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); for (Map.Entry<OperationalExtensionId, OperationalStats> entry : operationalStatsLoader.getAll().entrySet()) { OperationalStats operationalStats = entry.getValue(); ObjectName objectName = getObjectName(operationalStats); if (objectName == null) { LOG.warn("Found an operational extension with null service name and stat type - {}. Ignoring this extension.", OperationalStats.class.getName()); continue; } LOG.debug("Registering operational extension: {}; extension id: {}", operationalStats, entry.getKey()); // initialize operational stats operationalStats.initialize(injector); // register MBean mbs.registerMBean(operationalStats, objectName); } LOG.info("Successfully started Operational Stats Service..."); }