showuon commented on code in PR #14287:
URL: https://github.com/apache/kafka/pull/14287#discussion_r1319632459


##########
clients/src/main/java/org/apache/kafka/common/utils/AppInfoParser.java:
##########
@@ -60,8 +60,13 @@ public static String getCommitId() {
     public static synchronized void registerAppInfo(String prefix, String id, 
Metrics metrics, long nowMs) {
         try {
             ObjectName name = new ObjectName(prefix + ":type=app-info,id=" + 
Sanitizer.jmxSanitize(id));
+            MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+            if (server.isRegistered(name)) {
+                log.info("App info {} for {} already exists, so skipping  a 
new mbean creation", prefix, id);

Review Comment:
   Thanks. Please add tests for it.



-- 
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