test_class.declarator: EPS = 0.000001
test_class.modifier: private static final
test_class.original_string: private static final double EPS = 0.000001;
test_class.type: double
test_class.var_name: EPS
test_class.declarator: time = new MockTime()
test_class.modifier: private
test_class.original_string: private MockTime time = new MockTime();
test_class.type: MockTime
test_class.var_name: time
test_class.declarator: config = new MetricConfig()
test_class.modifier: private
test_class.original_string: private MetricConfig config = new MetricConfig();
test_class.type: MetricConfig
test_class.var_name: config
test_class.declarator: metrics
test_class.modifier: private
test_class.original_string: private Metrics metrics;
test_class.type: Metrics
test_class.var_name: metrics
test_class.file: clients/src/test/java/org/apache/kafka/common/metrics/MetricsTest.java
test_class.identifier: MetricsTest
test_case.body: @Test
      public void testRemoveSensor() {
          int size = metrics.metrics().size();
          Sensor parent1 = metrics.sensor("test.parent1");
          parent1.add(metrics.metricName("test.parent1.count", "grp1"), new Count());
          Sensor parent2 = metrics.sensor("test.parent2");
          parent2.add(metrics.metricName("test.parent2.count", "grp1"), new Count());
          Sensor child1 = metrics.sensor("test.child1", parent1, parent2);
          child1.add(metrics.metricName("test.child1.count", "grp1"), new Count());
          Sensor child2 = metrics.sensor("test.child2", parent2);
          child2.add(metrics.metricName("test.child2.count", "grp1"), new Count());
          Sensor grandChild1 = metrics.sensor("test.gchild2", child2);
          grandChild1.add(metrics.metricName("test.gchild2.count", "grp1"), new Count());
  
          Sensor sensor = metrics.getSensor("test.parent1");
          assertNotNull(sensor);
          metrics.removeSensor("test.parent1");
          assertNull(metrics.getSensor("test.parent1"));
          assertNull(metrics.metrics().get(metrics.metricName("test.parent1.count", "grp1")));
          assertNull(metrics.getSensor("test.child1"));
          assertNull(metrics.childrenSensors().get(sensor));
          assertNull(metrics.metrics().get(metrics.metricName("test.child1.count", "grp1")));
  
          sensor = metrics.getSensor("test.gchild2");
          assertNotNull(sensor);
          metrics.removeSensor("test.gchild2");
          assertNull(metrics.getSensor("test.gchild2"));
          assertNull(metrics.childrenSensors().get(sensor));
          assertNull(metrics.metrics().get(metrics.metricName("test.gchild2.count", "grp1")));
  
          sensor = metrics.getSensor("test.child2");
          assertNotNull(sensor);
          metrics.removeSensor("test.child2");
          assertNull(metrics.getSensor("test.child2"));
          assertNull(metrics.childrenSensors().get(sensor));
          assertNull(metrics.metrics().get(metrics.metricName("test.child2.count", "grp1")));
  
          sensor = metrics.getSensor("test.parent2");
          assertNotNull(sensor);
          metrics.removeSensor("test.parent2");
          assertNull(metrics.getSensor("test.parent2"));
          assertNull(metrics.childrenSensors().get(sensor));
          assertNull(metrics.metrics().get(metrics.metricName("test.parent2.count", "grp1")));
  
          assertEquals(size, metrics.metrics().size());
      }
test_case.class_method_signature: MetricsTest.testRemoveSensor()
test_case.full_signature: @Test public void testRemoveSensor()
test_case.identifier: testRemoveSensor
test_case.invocations: size metrics sensor add metricName sensor add metricName sensor add metricName sensor add metricName sensor add metricName getSensor assertNotNull removeSensor assertNull getSensor assertNull get metrics metricName assertNull getSensor assertNull get childrenSensors assertNull get metrics metricName getSensor assertNotNull removeSensor assertNull getSensor assertNull get childrenSensors assertNull get metrics metricName getSensor assertNotNull removeSensor assertNull getSensor assertNull get childrenSensors assertNull get metrics metricName getSensor assertNotNull removeSensor assertNull getSensor assertNull get childrenSensors assertNull get metrics metricName assertEquals size metrics
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRemoveSensor()
focal_class.declarator: config
focal_class.modifier: private final
focal_class.original_string: private final MetricConfig config;
focal_class.type: MetricConfig
focal_class.var_name: config
focal_class.declarator: metrics
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<MetricName, KafkaMetric> metrics;
focal_class.type: ConcurrentMap<MetricName, KafkaMetric>
focal_class.var_name: metrics
focal_class.declarator: sensors
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<String, Sensor> sensors;
focal_class.type: ConcurrentMap<String, Sensor>
focal_class.var_name: sensors
focal_class.declarator: childrenSensors
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<Sensor, List<Sensor>> childrenSensors;
focal_class.type: ConcurrentMap<Sensor, List<Sensor>>
focal_class.var_name: childrenSensors
focal_class.declarator: reporters
focal_class.modifier: private final
focal_class.original_string: private final List<MetricsReporter> reporters;
focal_class.type: List<MetricsReporter>
focal_class.var_name: reporters
focal_class.declarator: time
focal_class.modifier: private final
focal_class.original_string: private final Time time;
focal_class.type: Time
focal_class.var_name: time
focal_class.declarator: metricsScheduler
focal_class.modifier: private final
focal_class.original_string: private final ScheduledThreadPoolExecutor metricsScheduler;
focal_class.type: ScheduledThreadPoolExecutor
focal_class.var_name: metricsScheduler
focal_class.declarator: log = LoggerFactory.getLogger(Metrics.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(Metrics.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.file: clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java
focal_class.identifier: Metrics
focal_class.interfaces: implements Closeable
focal_class.class_method_signature: Metrics.Metrics()
focal_class.full_signature: public  Metrics()
focal_class.identifier: Metrics
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  Metrics()
focal_class.class_method_signature: Metrics.Metrics(Time time)
focal_class.full_signature: public  Metrics(Time time)
focal_class.identifier: Metrics
focal_class.modifiers: public
focal_class.parameters: (Time time)
focal_class.signature:  Metrics(Time time)
focal_class.class_method_signature: Metrics.Metrics(MetricConfig defaultConfig, Time time)
focal_class.full_signature: public  Metrics(MetricConfig defaultConfig, Time time)
focal_class.identifier: Metrics
focal_class.modifiers: public
focal_class.parameters: (MetricConfig defaultConfig, Time time)
focal_class.signature:  Metrics(MetricConfig defaultConfig, Time time)
focal_class.class_method_signature: Metrics.Metrics(MetricConfig defaultConfig)
focal_class.full_signature: public  Metrics(MetricConfig defaultConfig)
focal_class.identifier: Metrics
focal_class.modifiers: public
focal_class.parameters: (MetricConfig defaultConfig)
focal_class.signature:  Metrics(MetricConfig defaultConfig)
focal_class.class_method_signature: Metrics.Metrics(MetricConfig defaultConfig, List<MetricsReporter> reporters, Time time)
focal_class.full_signature: public  Metrics(MetricConfig defaultConfig, List<MetricsReporter> reporters, Time time)
focal_class.identifier: Metrics
focal_class.modifiers: public
focal_class.parameters: (MetricConfig defaultConfig, List<MetricsReporter> reporters, Time time)
focal_class.signature:  Metrics(MetricConfig defaultConfig, List<MetricsReporter> reporters, Time time)
focal_class.class_method_signature: Metrics.Metrics(MetricConfig defaultConfig, List<MetricsReporter> reporters, Time time, boolean enableExpiration)
focal_class.full_signature: public  Metrics(MetricConfig defaultConfig, List<MetricsReporter> reporters, Time time, boolean enableExpiration)
focal_class.identifier: Metrics
focal_class.modifiers: public
focal_class.parameters: (MetricConfig defaultConfig, List<MetricsReporter> reporters, Time time, boolean enableExpiration)
focal_class.signature:  Metrics(MetricConfig defaultConfig, List<MetricsReporter> reporters, Time time, boolean enableExpiration)
focal_class.class_method_signature: Metrics.metricName(String name, String group, String description, Map<String, String> tags)
focal_class.full_signature: public MetricName metricName(String name, String group, String description, Map<String, String> tags)
focal_class.identifier: metricName
focal_class.modifiers: public
focal_class.parameters: (String name, String group, String description, Map<String, String> tags)
focal_class.return: MetricName
focal_class.signature: MetricName metricName(String name, String group, String description, Map<String, String> tags)
focal_class.class_method_signature: Metrics.metricName(String name, String group, String description)
focal_class.full_signature: public MetricName metricName(String name, String group, String description)
focal_class.identifier: metricName
focal_class.modifiers: public
focal_class.parameters: (String name, String group, String description)
focal_class.return: MetricName
focal_class.signature: MetricName metricName(String name, String group, String description)
focal_class.class_method_signature: Metrics.metricName(String name, String group)
focal_class.full_signature: public MetricName metricName(String name, String group)
focal_class.identifier: metricName
focal_class.modifiers: public
focal_class.parameters: (String name, String group)
focal_class.return: MetricName
focal_class.signature: MetricName metricName(String name, String group)
focal_class.class_method_signature: Metrics.metricName(String name, String group, String description, String... keyValue)
focal_class.full_signature: public MetricName metricName(String name, String group, String description, String... keyValue)
focal_class.identifier: metricName
focal_class.modifiers: public
focal_class.parameters: (String name, String group, String description, String... keyValue)
focal_class.return: MetricName
focal_class.signature: MetricName metricName(String name, String group, String description, String... keyValue)
focal_class.class_method_signature: Metrics.metricName(String name, String group, Map<String, String> tags)
focal_class.full_signature: public MetricName metricName(String name, String group, Map<String, String> tags)
focal_class.identifier: metricName
focal_class.modifiers: public
focal_class.parameters: (String name, String group, Map<String, String> tags)
focal_class.return: MetricName
focal_class.signature: MetricName metricName(String name, String group, Map<String, String> tags)
focal_class.class_method_signature: Metrics.getTags(String... keyValue)
focal_class.full_signature: private static Map<String, String> getTags(String... keyValue)
focal_class.identifier: getTags
focal_class.modifiers: private static
focal_class.parameters: (String... keyValue)
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> getTags(String... keyValue)
focal_class.class_method_signature: Metrics.config()
focal_class.full_signature: public MetricConfig config()
focal_class.identifier: config
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: MetricConfig
focal_class.signature: MetricConfig config()
focal_class.class_method_signature: Metrics.getSensor(String name)
focal_class.full_signature: public Sensor getSensor(String name)
focal_class.identifier: getSensor
focal_class.modifiers: public
focal_class.parameters: (String name)
focal_class.return: Sensor
focal_class.signature: Sensor getSensor(String name)
focal_class.class_method_signature: Metrics.sensor(String name)
focal_class.full_signature: public Sensor sensor(String name)
focal_class.identifier: sensor
focal_class.modifiers: public
focal_class.parameters: (String name)
focal_class.return: Sensor
focal_class.signature: Sensor sensor(String name)
focal_class.class_method_signature: Metrics.sensor(String name, Sensor... parents)
focal_class.full_signature: public Sensor sensor(String name, Sensor... parents)
focal_class.identifier: sensor
focal_class.modifiers: public
focal_class.parameters: (String name, Sensor... parents)
focal_class.return: Sensor
focal_class.signature: Sensor sensor(String name, Sensor... parents)
focal_class.class_method_signature: Metrics.sensor(String name, MetricConfig config, Sensor... parents)
focal_class.full_signature: public synchronized Sensor sensor(String name, MetricConfig config, Sensor... parents)
focal_class.identifier: sensor
focal_class.modifiers: public synchronized
focal_class.parameters: (String name, MetricConfig config, Sensor... parents)
focal_class.return: Sensor
focal_class.signature: Sensor sensor(String name, MetricConfig config, Sensor... parents)
focal_class.class_method_signature: Metrics.sensor(String name, MetricConfig config, long inactiveSensorExpirationTimeSeconds, Sensor... parents)
focal_class.full_signature: public synchronized Sensor sensor(String name, MetricConfig config, long inactiveSensorExpirationTimeSeconds, Sensor... parents)
focal_class.identifier: sensor
focal_class.modifiers: public synchronized
focal_class.parameters: (String name, MetricConfig config, long inactiveSensorExpirationTimeSeconds, Sensor... parents)
focal_class.return: Sensor
focal_class.signature: Sensor sensor(String name, MetricConfig config, long inactiveSensorExpirationTimeSeconds, Sensor... parents)
focal_class.class_method_signature: Metrics.removeSensor(String name)
focal_class.full_signature: public void removeSensor(String name)
focal_class.identifier: removeSensor
focal_class.modifiers: public
focal_class.parameters: (String name)
focal_class.return: void
focal_class.signature: void removeSensor(String name)
focal_class.class_method_signature: Metrics.addMetric(MetricName metricName, Measurable measurable)
focal_class.full_signature: public void addMetric(MetricName metricName, Measurable measurable)
focal_class.identifier: addMetric
focal_class.modifiers: public
focal_class.parameters: (MetricName metricName, Measurable measurable)
focal_class.return: void
focal_class.signature: void addMetric(MetricName metricName, Measurable measurable)
focal_class.class_method_signature: Metrics.addMetric(MetricName metricName, MetricConfig config, Measurable measurable)
focal_class.full_signature: public synchronized void addMetric(MetricName metricName, MetricConfig config, Measurable measurable)
focal_class.identifier: addMetric
focal_class.modifiers: public synchronized
focal_class.parameters: (MetricName metricName, MetricConfig config, Measurable measurable)
focal_class.return: void
focal_class.signature: void addMetric(MetricName metricName, MetricConfig config, Measurable measurable)
focal_class.class_method_signature: Metrics.removeMetric(MetricName metricName)
focal_class.full_signature: public synchronized KafkaMetric removeMetric(MetricName metricName)
focal_class.identifier: removeMetric
focal_class.modifiers: public synchronized
focal_class.parameters: (MetricName metricName)
focal_class.return: KafkaMetric
focal_class.signature: KafkaMetric removeMetric(MetricName metricName)
focal_class.class_method_signature: Metrics.addReporter(MetricsReporter reporter)
focal_class.full_signature: public synchronized void addReporter(MetricsReporter reporter)
focal_class.identifier: addReporter
focal_class.modifiers: public synchronized
focal_class.parameters: (MetricsReporter reporter)
focal_class.return: void
focal_class.signature: void addReporter(MetricsReporter reporter)
focal_class.class_method_signature: Metrics.registerMetric(KafkaMetric metric)
focal_class.full_signature: synchronized void registerMetric(KafkaMetric metric)
focal_class.identifier: registerMetric
focal_class.modifiers: synchronized
focal_class.parameters: (KafkaMetric metric)
focal_class.return: void
focal_class.signature: void registerMetric(KafkaMetric metric)
focal_class.class_method_signature: Metrics.metrics()
focal_class.full_signature: public Map<MetricName, KafkaMetric> metrics()
focal_class.identifier: metrics
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Map<MetricName, KafkaMetric>
focal_class.signature: Map<MetricName, KafkaMetric> metrics()
focal_class.class_method_signature: Metrics.childrenSensors()
focal_class.full_signature:  Map<Sensor, List<Sensor>> childrenSensors()
focal_class.identifier: childrenSensors
focal_class.parameters: ()
focal_class.return: Map<Sensor, List<Sensor>>
focal_class.signature: Map<Sensor, List<Sensor>> childrenSensors()
focal_class.class_method_signature: Metrics.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_method.body: public void removeSensor(String name) {
          Sensor sensor = sensors.get(name);
          if (sensor != null) {
              List<Sensor> childSensors = null;
              synchronized (sensor) {
                  synchronized (this) {
                      if (sensors.remove(name, sensor)) {
                          for (KafkaMetric metric : sensor.metrics())
                              removeMetric(metric.metricName());
                          log.debug("Removed sensor with name {}", name);
                          childSensors = childrenSensors.remove(sensor);
                      }
                  }
              }
              if (childSensors != null) {
                  for (Sensor childSensor : childSensors)
                      removeSensor(childSensor.name());
              }
          }
      }
focal_method.class_method_signature: Metrics.removeSensor(String name)
focal_method.full_signature: public void removeSensor(String name)
focal_method.identifier: removeSensor
focal_method.invocations: get remove metrics removeMetric metricName debug remove removeSensor name
focal_method.modifiers: public
focal_method.parameters: (String name)
focal_method.return: void
focal_method.signature: void removeSensor(String name)