RongtongJin opened a new pull request, #9678: URL: https://github.com/apache/rocketmq/pull/9678
<!-- Please make sure the target branch is right. In most case, the target branch should be `develop`. --> ### Which Issue(s) This PR Fixes <!-- Please ensure that the related issue has already been created, and [link this pull request to that issue using keywords](<https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword>) to ensure automatic closure. --> Fixes #9677 This PR resolves critical metrics conflicts and resource leaks in BrokerContainer mode by converting static metrics variables to instance-level variables, ensuring proper isolation between multiple broker instances. ### Brief Description <!-- Write a brief description for your pull request to help the maintainer understand the reasons behind your changes. --> #### 1. BrokerMetricsManager Refactoring - ✅ Convert all static metrics variables to private instance variables - ✅ Add getter methods for external access to metrics - ✅ Convert `newAttributesBuilder()` from static to instance method - ✅ Add `setAttributesBuilderSupplier()` for testing support - ✅ Maintain backward compatibility for all existing functionality #### 2. TimerMessageStore Compilation Fixes - ✅ Replace static method calls with instance method calls - ✅ Add `instanceof DefaultMessageStore` type safety checks - ✅ Use proper metrics manager instance access pattern - ✅ Follow the same refactoring pattern as BrokerMetricsManager #### 3. Documentation and Guidelines - ✅ Add comprehensive refactoring guide (METRICS_REFACTORING_GUIDE.md) - ✅ Document migration patterns and best practices - ✅ Provide troubleshooting guidelines ### How Did You Test This Change? <!-- In order to ensure the code quality of Apache RocketMQ, we expect every pull request to have undergone thorough testing. --> -- 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]
