private void initMonitoringLevel() { try{ Config cfg = habitat.getComponent(Config.class, ServerEnvironment.DEFAULT_INSTANCE_NAME ); MonitoringLevel monitoringLevel = MonitoringLevel.OFF; // default per DTD if (cfg.getMonitoringService() != null) { ModuleMonitoringLevels levels = cfg.getMonitoringService().getModuleMonitoringLevels(); if (levels != null) { monitoringLevel = MonitoringLevel.instance( levels.getHttpService()); } } if(MonitoringLevel.OFF.equals(monitoringLevel)) { isMonitoringEnabled = false; } else { isMonitoringEnabled = true; } String methodToInvoke = isMonitoringEnabled ? "enableMonitoring" : "disableMonitoring"; invokeGrizzly(methodToInvoke); } catch (Exception ex) { String msg = rb.getString("selectorThread.initMonitoringException"); msg = MessageFormat.format(msg, Integer.valueOf(port)); logger.log(Level.WARNING, msg, ex); } }
@Override public boolean preAuthorization(AdminCommandContext context) { final ActionReport report = context.getActionReport(); try { targetConfig = targetService.getConfig(target); if (targetConfig != null) { ms = targetConfig.getMonitoringService(); return true; } fail(report, "unknown.target", "Could not find target {0}", target); return false; } catch (Exception e) { fail(report, "target.service.exception", "Encountered exception trying to locate the MonitoringService element " + "in the target ({0}) configuration: {1}", target, e.getMessage()); return false; } }
@Override public boolean preAuthorization(AdminCommandContext context) { final ActionReport report = context.getActionReport(); try { targetConfig = targetService.getConfig(target); if (targetConfig != null) { ms = targetConfig.getMonitoringService(); return true; } fail(report, "unknown.target", "Could not find target {0}", target); return false; } catch (Exception e) { fail(report, "target.service.exception", "Encountered exception trying to locate the MonitoringService element " + "in the target ({0}) configuration: {1}", target, e.getMessage()); return false; } }
@Override public void postConstruct() { // Listen to monitoring level changes Config c = habitat.getService(Config.class, ServerEnvironment.DEFAULT_INSTANCE_NAME); ts = c.getExtensionByType(TransactionService.class); ModuleMonitoringLevels mml = c.getMonitoringService().getModuleMonitoringLevels(); ((ObservableBean)ConfigSupport.getImpl(mml)).addListener(this); }
public void postConstruct() { String instanceName = serverEnvironment.getInstanceName(); Server server = domain.getServerNamed(instanceName); Config config = server.getConfig(); if (config != null) { MonitoringService monitoringService = config.getMonitoringService(); if (monitoringService != null) { ModuleMonitoringLevels monitoringLevel = monitoringService.getModuleMonitoringLevels(); if (monitoringLevel != null) { this.monitoringLevel = monitoringLevel; ObservableBean bean = (ObservableBean) ConfigSupport.getImpl((ConfigBeanProxy) monitoringLevel); bean.addListener(this); jdbcPoolMonitoringEnabled = !monitoringLevel.getJdbcConnectionPool().equalsIgnoreCase("OFF"); connectorPoolMonitoringEnabled = !monitoringLevel.getConnectorConnectionPool().equalsIgnoreCase("OFF"); } } } }
public static void addIndex(Config c, ServiceLocator habitat, String name) { ServiceLocatorUtilities.addOneDescriptor(habitat, BuilderHelper.createConstantDescriptor(c, name, Config.class)); // directly referenced objects ConfigBeanProxy dirref[] = { c.getAdminService(), c.getAvailabilityService(), c.getDiagnosticService(), c.getHttpService(), c.getJavaConfig(), c.getLogService(), c.getNetworkConfig(), c.getSecurityService(), c.getThreadPools(), c.getMonitoringService(), }; for (ConfigBeanProxy cbp : dirref) { if (cbp != null) { ServiceLocatorUtilities.addOneDescriptor(habitat, BuilderHelper.createConstantDescriptor(cbp, name, ConfigSupport.getImpl(cbp).getProxyType())); } } // containers for (Container extension : c.getContainers()) { ServiceLocatorUtilities.addOneDescriptor(habitat, BuilderHelper.createConstantDescriptor(extension, name, ConfigSupport.getImpl(extension).getProxyType())); } }