test_class.declarator: gaugeCollector
test_class.modifier: private
test_class.original_string: private GaugeCollector gaugeCollector;
test_class.type: GaugeCollector
test_class.var_name: gaugeCollector
test_class.declarator: lazyPlatformMBeanServer
test_class.modifier: private
test_class.original_string: private LazyPlatformMBeanServer lazyPlatformMBeanServer;
test_class.type: LazyPlatformMBeanServer
test_class.var_name: lazyPlatformMBeanServer
test_class.declarator: clock
test_class.modifier: private
test_class.original_string: private Clock clock;
test_class.type: Clock
test_class.var_name: clock
test_class.declarator: ticker
test_class.modifier: private
test_class.original_string: private Ticker ticker;
test_class.type: Ticker
test_class.var_name: ticker
test_class.declarator: logger
test_class.modifier: private
test_class.original_string: private Logger logger;
test_class.type: Logger
test_class.var_name: logger
test_class.file: agent/core/src/test/java/org/glowroot/agent/init/GaugeCollectorTest.java
test_class.identifier: GaugeCollectorTest
test_case.body: @Test
      public void shouldHandleMBeanInstanceNotFoundBeforeLoggingDelay() throws Exception {
          // given
          GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder()
                  .mbeanObjectName("xyz:aaa=bbb")
                  .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", false))
                  .addMbeanAttributes(ImmutableMBeanAttribute.of("ddd", false))
                  .build();
          when(clock.currentTimeMillis()).thenReturn(59999L);
          when(lazyPlatformMBeanServer.getAttribute(any(ObjectName.class), anyString(),
                  anyMBeanServerList())).thenThrow(InstanceNotFoundException.class);
  
          // when
          List<GaugeValue> gaugeValues =
                  collectGaugeValues(gaugeConfig);
  
          // then
          assertThat(gaugeValues).isEmpty();
          verify(logger).debug(nullable(String.class), any(Exception.class));
      }
test_case.class_method_signature: GaugeCollectorTest.shouldHandleMBeanInstanceNotFoundBeforeLoggingDelay()
test_case.full_signature: @Test public void shouldHandleMBeanInstanceNotFoundBeforeLoggingDelay()
test_case.identifier: shouldHandleMBeanInstanceNotFoundBeforeLoggingDelay
test_case.invocations: build addMbeanAttributes addMbeanAttributes mbeanObjectName builder of of thenReturn when currentTimeMillis thenThrow when getAttribute any anyString anyMBeanServerList collectGaugeValues isEmpty assertThat debug verify nullable any
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldHandleMBeanInstanceNotFoundBeforeLoggingDelay()
focal_class.declarator: logger = LoggerFactory.getLogger(GaugeCollector.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(GaugeCollector.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: PENDING_LIMIT = 60
focal_class.modifier: private static final
focal_class.original_string: private static final int PENDING_LIMIT = 60;
focal_class.type: int
focal_class.var_name: PENDING_LIMIT
focal_class.declarator: configService
focal_class.modifier: private final
focal_class.original_string: private final ConfigService configService;
focal_class.type: ConfigService
focal_class.var_name: configService
focal_class.declarator: collector
focal_class.modifier: private final
focal_class.original_string: private final Collector collector;
focal_class.type: Collector
focal_class.var_name: collector
focal_class.declarator: lazyPlatformMBeanServer
focal_class.modifier: private final
focal_class.original_string: private final LazyPlatformMBeanServer lazyPlatformMBeanServer;
focal_class.type: LazyPlatformMBeanServer
focal_class.var_name: lazyPlatformMBeanServer
focal_class.declarator: clock
focal_class.modifier: private final
focal_class.original_string: private final Clock clock;
focal_class.type: Clock
focal_class.var_name: clock
focal_class.declarator: ticker
focal_class.modifier: private final
focal_class.original_string: private final Ticker ticker;
focal_class.type: Ticker
focal_class.var_name: ticker
focal_class.declarator: startTimeMillis
focal_class.modifier: private final
focal_class.original_string: private final long startTimeMillis;
focal_class.type: long
focal_class.var_name: startTimeMillis
focal_class.declarator: pendingLoggedMBeanGauges = Sets.newConcurrentHashSet()
focal_class.modifier: private final
focal_class.original_string: private final Set<String> pendingLoggedMBeanGauges = Sets.newConcurrentHashSet();
focal_class.type: Set<String>
focal_class.var_name: pendingLoggedMBeanGauges
focal_class.declarator: loggedMBeanGauges = Sets.newConcurrentHashSet()
focal_class.modifier: private final
focal_class.original_string: private final Set<String> loggedMBeanGauges = Sets.newConcurrentHashSet();
focal_class.type: Set<String>
focal_class.var_name: loggedMBeanGauges
focal_class.declarator: collectionExecutor
focal_class.modifier: private final
focal_class.original_string: private final ScheduledExecutorService collectionExecutor;
focal_class.type: ScheduledExecutorService
focal_class.var_name: collectionExecutor
focal_class.declarator: flushingExecutor
focal_class.modifier: private final
focal_class.original_string: private final ExecutorService flushingExecutor;
focal_class.type: ExecutorService
focal_class.var_name: flushingExecutor
focal_class.declarator: pending =
              Queues.newLinkedBlockingQueue(PENDING_LIMIT)
focal_class.modifier: private final
focal_class.original_string: private final BlockingQueue<List<GaugeValue>> pending =
              Queues.newLinkedBlockingQueue(PENDING_LIMIT);
focal_class.type: BlockingQueue<List<GaugeValue>>
focal_class.var_name: pending
focal_class.declarator: backPressureLogger =
              new RateLimitedLogger(GaugeCollector.class)
focal_class.modifier: private final
focal_class.original_string: private final RateLimitedLogger backPressureLogger =
              new RateLimitedLogger(GaugeCollector.class);
focal_class.type: RateLimitedLogger
focal_class.var_name: backPressureLogger
focal_class.declarator: priorRawCounterValues
focal_class.modifier: private @MonotonicNonNull
focal_class.original_string: private @MonotonicNonNull Map<String, RawCounterValue> priorRawCounterValues;
focal_class.type: Map<String, RawCounterValue>
focal_class.var_name: priorRawCounterValues
focal_class.declarator: closed
focal_class.modifier: private volatile
focal_class.original_string: private volatile boolean closed;
focal_class.type: boolean
focal_class.var_name: closed
focal_class.file: agent/core/src/main/java/org/glowroot/agent/init/GaugeCollector.java
focal_class.identifier: GaugeCollector
focal_class.class_method_signature: GaugeCollector.GaugeCollector(ConfigService configService, Collector collector,
              LazyPlatformMBeanServer lazyPlatformMBeanServer,
              final @Nullable Instrumentation instrumentation, Clock clock, Ticker ticker)
focal_class.full_signature:   GaugeCollector(ConfigService configService, Collector collector,
              LazyPlatformMBeanServer lazyPlatformMBeanServer,
              final @Nullable Instrumentation instrumentation, Clock clock, Ticker ticker)
focal_class.identifier: GaugeCollector
focal_class.parameters: (ConfigService configService, Collector collector,
              LazyPlatformMBeanServer lazyPlatformMBeanServer,
              final @Nullable Instrumentation instrumentation, Clock clock, Ticker ticker)
focal_class.signature:  GaugeCollector(ConfigService configService, Collector collector,
              LazyPlatformMBeanServer lazyPlatformMBeanServer,
              final @Nullable Instrumentation instrumentation, Clock clock, Ticker ticker)
focal_class.class_method_signature: GaugeCollector.runInternal()
focal_class.full_signature: @Override protected void runInternal()
focal_class.identifier: runInternal
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void runInternal()
focal_class.class_method_signature: GaugeCollector.scheduleWithFixedDelay(long period, TimeUnit unit)
focal_class.full_signature:  void scheduleWithFixedDelay(long period, TimeUnit unit)
focal_class.identifier: scheduleWithFixedDelay
focal_class.parameters: (long period, TimeUnit unit)
focal_class.return: void
focal_class.signature: void scheduleWithFixedDelay(long period, TimeUnit unit)
focal_class.class_method_signature: GaugeCollector.close()
focal_class.full_signature:  void close()
focal_class.identifier: close
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_class.class_method_signature: GaugeCollector.collectGaugeValues(GaugeConfig gaugeConfig, List<MBeanServer> mbeanServers)
focal_class.full_signature: @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig, List<MBeanServer> mbeanServers)
focal_class.identifier: collectGaugeValues
focal_class.modifiers: @VisibleForTesting @RequiresNonNull("priorRawCounterValues")
focal_class.parameters: (GaugeConfig gaugeConfig, List<MBeanServer> mbeanServers)
focal_class.return: List<GaugeValue>
focal_class.signature: List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig, List<MBeanServer> mbeanServers)
focal_class.class_method_signature: GaugeCollector.collectGaugeValues(ObjectName objectName,
              List<ImmutableMBeanAttribute> mbeanAttributes, String mbeanObjectName,
              List<MBeanServer> mbeanServers)
focal_class.full_signature: @RequiresNonNull("priorRawCounterValues") private List<GaugeValue> collectGaugeValues(ObjectName objectName,
              List<ImmutableMBeanAttribute> mbeanAttributes, String mbeanObjectName,
              List<MBeanServer> mbeanServers)
focal_class.identifier: collectGaugeValues
focal_class.modifiers: @RequiresNonNull("priorRawCounterValues") private
focal_class.parameters: (ObjectName objectName,
              List<ImmutableMBeanAttribute> mbeanAttributes, String mbeanObjectName,
              List<MBeanServer> mbeanServers)
focal_class.return: List<GaugeValue>
focal_class.signature: List<GaugeValue> collectGaugeValues(ObjectName objectName,
              List<ImmutableMBeanAttribute> mbeanAttributes, String mbeanObjectName,
              List<MBeanServer> mbeanServers)
focal_class.class_method_signature: GaugeCollector.logFirstTimeMBeanNotMatchedOrFound(String mbeanObjectName)
focal_class.full_signature: private void logFirstTimeMBeanNotMatchedOrFound(String mbeanObjectName)
focal_class.identifier: logFirstTimeMBeanNotMatchedOrFound
focal_class.modifiers: private
focal_class.parameters: (String mbeanObjectName)
focal_class.return: void
focal_class.signature: void logFirstTimeMBeanNotMatchedOrFound(String mbeanObjectName)
focal_class.class_method_signature: GaugeCollector.logFirstTimeMBeanAttributeNotFound(String mbeanObjectName,
              String mbeanAttributeName)
focal_class.full_signature: private void logFirstTimeMBeanAttributeNotFound(String mbeanObjectName,
              String mbeanAttributeName)
focal_class.identifier: logFirstTimeMBeanAttributeNotFound
focal_class.modifiers: private
focal_class.parameters: (String mbeanObjectName,
              String mbeanAttributeName)
focal_class.return: void
focal_class.signature: void logFirstTimeMBeanAttributeNotFound(String mbeanObjectName,
              String mbeanAttributeName)
focal_class.class_method_signature: GaugeCollector.logFirstTimeMBeanException(String mbeanObjectName, Exception e)
focal_class.full_signature: private void logFirstTimeMBeanException(String mbeanObjectName, Exception e)
focal_class.identifier: logFirstTimeMBeanException
focal_class.modifiers: private
focal_class.parameters: (String mbeanObjectName, Exception e)
focal_class.return: void
focal_class.signature: void logFirstTimeMBeanException(String mbeanObjectName, Exception e)
focal_class.class_method_signature: GaugeCollector.logFirstTimeMBeanAttributeError(String mbeanObjectName, String mbeanAttributeName,
              String message)
focal_class.full_signature: private void logFirstTimeMBeanAttributeError(String mbeanObjectName, String mbeanAttributeName,
              String message)
focal_class.identifier: logFirstTimeMBeanAttributeError
focal_class.modifiers: private
focal_class.parameters: (String mbeanObjectName, String mbeanAttributeName,
              String message)
focal_class.return: void
focal_class.signature: void logFirstTimeMBeanAttributeError(String mbeanObjectName, String mbeanAttributeName,
              String message)
focal_class.class_method_signature: GaugeCollector.logFirstTimeMBeanAttributeError(String mbeanObjectName, String mbeanAttributeName,
              Exception e)
focal_class.full_signature: private void logFirstTimeMBeanAttributeError(String mbeanObjectName, String mbeanAttributeName,
              Exception e)
focal_class.identifier: logFirstTimeMBeanAttributeError
focal_class.modifiers: private
focal_class.parameters: (String mbeanObjectName, String mbeanAttributeName,
              Exception e)
focal_class.return: void
focal_class.signature: void logFirstTimeMBeanAttributeError(String mbeanObjectName, String mbeanAttributeName,
              Exception e)
focal_class.superclass: extends ScheduledRunnable
focal_method.body: @VisibleForTesting
      @RequiresNonNull("priorRawCounterValues")
      List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig, List<MBeanServer> mbeanServers)
              throws Exception {
          String mbeanObjectName = gaugeConfig.mbeanObjectName();
          ObjectName objectName;
          try {
              objectName = ObjectName.getInstance(mbeanObjectName);
          } catch (MalformedObjectNameException e) {
              logger.debug(e.getMessage(), e);
              logFirstTimeMBeanException(mbeanObjectName, e);
              return ImmutableList.of();
          }
          if (!objectName.isPattern()) {
              return collectGaugeValues(objectName, gaugeConfig.mbeanAttributes(), mbeanObjectName,
                      mbeanServers);
          }
          Set<ObjectName> matchingObjectNames =
                  lazyPlatformMBeanServer.queryNames(objectName, null, mbeanServers);
          if (matchingObjectNames.isEmpty()) {
              logFirstTimeMBeanNotMatchedOrFound(mbeanObjectName);
              return ImmutableList.of();
          }
          // remove from pendingLoggedMBeanGauges so if it is later not found, it will be logged
          // normally and not with "waited ... seconds after jvm startup before logging this" message
          pendingLoggedMBeanGauges.remove(mbeanObjectName);
          List<GaugeValue> gaugeValues = Lists.newArrayList();
          for (ObjectName matchingObjectName : matchingObjectNames) {
              gaugeValues.addAll(collectGaugeValues(matchingObjectName, gaugeConfig.mbeanAttributes(),
                      matchingObjectName.getDomain() + ":"
                              + matchingObjectName.getKeyPropertyListString(),
                      mbeanServers));
          }
          return gaugeValues;
      }
focal_method.class_method_signature: GaugeCollector.collectGaugeValues(GaugeConfig gaugeConfig, List<MBeanServer> mbeanServers)
focal_method.full_signature: @VisibleForTesting @RequiresNonNull("priorRawCounterValues") List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig, List<MBeanServer> mbeanServers)
focal_method.identifier: collectGaugeValues
focal_method.invocations: mbeanObjectName getInstance debug getMessage logFirstTimeMBeanException of isPattern collectGaugeValues mbeanAttributes queryNames isEmpty logFirstTimeMBeanNotMatchedOrFound of remove newArrayList addAll collectGaugeValues mbeanAttributes getDomain getKeyPropertyListString
focal_method.modifiers: @VisibleForTesting @RequiresNonNull("priorRawCounterValues")
focal_method.parameters: (GaugeConfig gaugeConfig, List<MBeanServer> mbeanServers)
focal_method.return: List<GaugeValue>
focal_method.signature: List<GaugeValue> collectGaugeValues(GaugeConfig gaugeConfig, List<MBeanServer> mbeanServers)