philipnee commented on PR #15216:
URL: https://github.com/apache/kafka/pull/15216#issuecomment-1921750518
@lucasbru - Thank you for spending time reviewing the PR. I responded to
your comment about resource closing. It is indeed a bit strange why we need to
do this.
A weird thing I found while reviewing sensor code is that - there's a cyclic
relationship between sensor and metrics. Sensor holds on to Metric's reference
and Metrics holds on to sensor lookup map (which has Sensor as the val). See
this
```
public class Metrics implements Closeable {
private final MetricConfig config;
private final ConcurrentMap<MetricName, KafkaMetric> metrics;
private final ConcurrentMap<String, Sensor> sensors;
```
and
```
public final class Sensor {
private final Metrics registry;
```
I wonder if this is why we should remove these sensors upon closing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]