You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/06/10 15:56:22 UTC

[GitHub] [kafka] divijvaidya opened a new pull request, #12282: MINOR: Fail if Logging controller bean is not correctly registered

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

   Two changes in this PR.
   
   1. Remove synchronized block and simplify it by using a latch.
   
   2. Do not ignore the return value for `CoreUtils.registerMBean`. Since the method does not throw an exception, the return type tells us whether the registration was successful or not.
   
   Note that after this change we are throwing an exception if we fail to load the log4j controller BUT we do not fail if we fail to load a metrics reporter bean (existing behaviour).
   


-- 
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-unsubscribe@kafka.apache.org

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


[GitHub] [kafka] ijuma commented on a diff in pull request #12282: MINOR: Fail if Logging controller bean is not correctly registered

Posted by GitBox <gi...@apache.org>.
ijuma commented on code in PR #12282:
URL: https://github.com/apache/kafka/pull/12282#discussion_r942492154


##########
core/src/main/scala/kafka/utils/Logging.scala:
##########
@@ -27,7 +27,10 @@ object Log4jControllerRegistration {
   try {
     val log4jController = Class.forName("kafka.utils.Log4jController").asInstanceOf[Class[Object]]
     val instance = log4jController.getDeclaredConstructor().newInstance()
-    CoreUtils.registerMBean(instance, "kafka:type=kafka.Log4jController")
+    val success = CoreUtils.registerMBean(instance, "kafka:type=kafka.Log4jController")
+    if (!success) {
+      throw new IllegalArgumentException

Review Comment:
   This should have a message. Also, we should decide if we want to shutdown or if we want to log it. I usually prefer fail-fast, but not sure in this case. For example, what happens if there are multiple brokers running in the same jvm?



-- 
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-unsubscribe@kafka.apache.org

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