コード例 #1
0
  /* throws RuntimeException maybe
   * note the default visibility so that MonitoringBootstrap can call it.
   */
  void tryToRegister(StatsProviderInfo spInfo) {
    final String configElement = spInfo.getConfigElement();
    Object statsProvider = spInfo.getStatsProvider();
    // register the statsProvider
    if (logger.isLoggable(Level.FINE)) logger.fine("registering a statsProvider");
    StatsProviderRegistryElement spre;
    // If configElement is null, create it
    if (monitoringService != null
        && monitoringService.getContainerMonitoring(configElement) == null
        && monitoringService.getMonitoringLevel(configElement) == null) {
      createConfigElement(configElement);
    }

    // First check if the configElement associated for statsProvider is 'ON'
    if (getMonitoringEnabled() && getEnabledValue(configElement)) {
      if (logger.isLoggable(Level.FINE)) logger.fine(" enabled is true ");
      spre = statsProviderRegistry.getStatsProviderRegistryElement(statsProvider);

      if (spre == null) {
        statsProviderRegistry.registerStatsProvider(spInfo);
        spre = statsProviderRegistry.getStatsProviderRegistryElement(statsProvider);
      }
      // Enable the StatsProvider if the enable is allowed
      if (spre.isEnableAllowed(getMonitoringLevel(configElement))) {
        enableStatsProvider(spre);
      }

    } else {
      if (logger.isLoggable(Level.FINE)) logger.fine(" enabled is false ");
      // Register with null values so to know that we need to register them individually and config
      // is on
      statsProviderRegistry.registerStatsProvider(spInfo);
      spre = statsProviderRegistry.getStatsProviderRegistryElement(statsProvider);
    }

    if (logger.isLoggable(Level.FINE)) {
      logger.fine(spre.toString());
      logger.fine("=========================================================");
    }
  }
コード例 #2
0
 private boolean getMbeanEnabledValue() {
   return Boolean.parseBoolean(monitoringService.getMbeanEnabled());
 }
コード例 #3
0
 private String getMonitoringLevel(String configElement) {
   return monitoringService.getMonitoringLevel(configElement);
 }