nizhikov commented on code in PR #12574:
URL: https://github.com/apache/kafka/pull/12574#discussion_r962504857


##########
core/src/main/scala/kafka/server/BrokerServer.scala:
##########
@@ -448,6 +448,7 @@ class BrokerServer(
       try {
         metadataListener.startPublishing(metadataPublisher).get()
       } catch {
+        case ee: ExecutionException => throw ee
         case t: Throwable => throw new RuntimeException("Received a fatal 
error while " +
           "waiting for the broker to catch up with the current cluster 
metadata.", t)

Review Comment:
   > Or maybe just throw e and don't care about getCause
   
   This implemented right now in trunk :)
   
   > if we confirmed all the exceptions are wrapped with RuntimeException
   
   `CompletableFuture.get` can throw different type of exceptions. From javadoc 
- `CancellationException`, `InterruptedException`.
   
   > I'm afraid after this change, it'll lose it and just throw 
ExecutionException directly.
   
   I thought that is a goal of the 
[KAFKA-13908](https://issues.apache.org/jira/browse/KAFKA-13908).
   To throw original exception not a wrapper.
   
   > throw if (e.isInstanceOf[RuntimeException]) e.getCause.getCause else e
   
   RuntimeException can be throwed from the other lines of try block, so this 
logic can cause NPE.



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

Reply via email to