andyhuangdev commented on code in PR #23561:
URL: https://github.com/apache/kafka/pull/23561#discussion_r4594741230
##########
tools/src/test/java/org/apache/kafka/tools/JmxToolTest.java:
##########
@@ -65,15 +79,16 @@ public static void beforeAll() throws Exception {
env.put("com.sun.management.jmxremote.ssl", "false");
JMXServiceURL url = new JMXServiceURL(jmxUrl);
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
- server.registerMBean(new Metrics(),
+ jmxFixture = new JmxFixture(server,
new
ObjectName("kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec"));
- jmxAgent = JMXConnectorServerFactory.newJMXConnectorServer(url, env,
server);
- jmxAgent.start();
+ jmxFixture.start(() ->
JMXConnectorServerFactory.newJMXConnectorServer(url, env, server));
}
@AfterAll
public static void afterAll() throws Exception {
- jmxAgent.stop();
+ if (jmxFixture != null) {
+ jmxFixture.close();
Review Comment:
I'll remove the fixture and its lifecycle tests, and unregister the MBean
directly in afterAll().
--
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]