public boolean isStatsProviderRegistered(Object statsProvider, String subTreePath) { boolean isStatsProviderRegistered = false; Collection<StatsProviderRegistry.StatsProviderRegistryElement> spreList = statsProviderRegistry.getSpreList(); for (StatsProviderRegistry.StatsProviderRegistryElement spre : spreList) { if (spre.getStatsProvider().equals(statsProvider) && spre.getMBeanName().equals(subTreePath)) { isStatsProviderRegistered = true; } } return isStatsProviderRegistered; }
// Called when AMX DomainRoot is loaded (when jconsole or gui is started) // Register statsProviders with gmbal whose configElement is enabled // Save mom in the spre. Used in unregister with gmbal later for config change to OFF or undeploy // Set AMXReady flag to true @Override public void mbeanRegistered(final ObjectName objectName, final MBeanListener listener) { super.mbeanRegistered(objectName, listener); AMXReady = true; statsProviderRegistry.setAMXReady(true); if (this.getMbeanEnabledValue()) { for (StatsProviderRegistry.StatsProviderRegistryElement spre : statsProviderRegistry.getSpreList()) { if (spre.isEnabled()) { ManagedObjectManager mom = spre.getManagedObjectManager(); if (mom == null) { mom = registerGmbal(spre.getStatsProvider(), spre.getMBeanName()); spre.setManagedObjectManager(mom); } } } } }