ChengyanOo opened a new pull request, #17439:
URL: https://github.com/apache/kafka/pull/17439

   The issue of 'this' escape in the `BrokerTopicMetrics` class was caused by 
the `GaugeWrapper` class, which is a inner class and held an inherited 
reference to `this` from `BrokerTopicMetrics`. The `BrokerTopicMetrics` 
constructor invoked the creation of a new `GaugeWrapper`, resulting in the 
unsafe exposure of `this` during construction.
   
   This PR resolves the issue by changing the `GaugeWrapper` class to be a 
`static` class, thus removing the implicit reference to the outer 
`BrokerTopicMetrics` instance.
   
   Tested by rebuilding the project with Java 23
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to