use of org.glassfish.admin.monitor.StatsProviderRegistry.StatsProviderRegistryElement in project Payara by payara.
the class StatsProviderManagerDelegateImpl method registerAllGmbal.
public void registerAllGmbal() {
if (logger.isLoggable(Level.FINE))
logger.fine("Registering all the statsProviders whose enabled flag is 'on' with Gmbal");
for (StatsProviderRegistryElement spre : statsProviderRegistry.getSpreList()) {
if (spre.isEnabled()) {
ManagedObjectManager mom = spre.getManagedObjectManager();
if (mom == null) {
mom = registerGmbal(spre.getStatsProvider(), spre.getMBeanName());
spre.setManagedObjectManager(mom);
}
}
}
}
use of org.glassfish.admin.monitor.StatsProviderRegistry.StatsProviderRegistryElement in project Payara by payara.
the class StatsProviderManagerDelegateImpl method enableStatsProviders.
/* called from SMPD, when monitoring level for a module is turned on */
public void enableStatsProviders(String configElement) {
// If monitoring-enabled is false, just return
if (!getMonitoringEnabled())
return;
String configLevel = getMonitoringLevel(configElement);
// Enable all the StatsProviders for a given configElement
if (logger.isLoggable(Level.FINE))
logger.fine("Enabling all the statsProviders for - " + configElement);
List<StatsProviderRegistryElement> spreList = statsProviderRegistry.getStatsProviderRegistryElement(configElement);
if (spreList == null)
return;
for (StatsProviderRegistryElement spre : spreList) {
// Check to see if the enable is allowed
// Not allowed if statsProvider is registered for Low and configLevel is HIGH
boolean isEnableAllowed = spre.isEnableAllowed(configLevel);
if (!spre.isEnabled()) {
// OFF->LOW, OFF->HIGH
if (isEnableAllowed) {
enableStatsProvider(spre);
}
} else {
// stats were registered at HIGH
if (!isEnableAllowed) {
disableStatsProvider(spre);
}
// else, Dont do anything LOW->HIGH (stats were registered at LOW)
}
}
}
use of org.glassfish.admin.monitor.StatsProviderRegistry.StatsProviderRegistryElement in project Payara by payara.
the class StatsProviderManagerDelegateImpl method createTreeForStatsProvider.
private List<String> createTreeForStatsProvider(TreeNode parentNode, Object statsProvider) {
/* construct monitoring tree at PluginPoint using subTreePath */
List<String> childNodeNames = new ArrayList();
/* Check for custom reset method and store for later to be called instead of
standard reset methods on Statistic classes*/
for (Method m : statsProvider.getClass().getMethods()) {
ManagedAttribute ma = m.getAnnotation(ManagedAttribute.class);
Reset resetMeth = m.getAnnotation(Reset.class);
if (resetMeth != null) {
StatsProviderRegistryElement spre = this.statsProviderRegistry.getStatsProviderRegistryElement(statsProvider);
spre.setResetMethod(m);
}
if (ma != null) {
String methodName = m.getName();
String id = ma.id();
if ((id == null) || id.isEmpty()) {
// if id not specified, derive from method name
String methodNameLower = methodName.toLowerCase(Locale.ENGLISH);
if (methodNameLower.startsWith("get") && methodNameLower.length() > 3) {
id = methodNameLower.substring(3);
}
}
TreeNode attrNode = TreeNodeFactory.createMethodInvoker(id, statsProvider, id, m);
parentNode.addChild(attrNode);
childNodeNames.add(attrNode.getName());
}
}
return childNodeNames;
}
Aggregations