Yunyung commented on code in PR #20159: URL: https://github.com/apache/kafka/pull/20159#discussion_r2250095204
########## clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java: ########## @@ -1225,7 +1243,9 @@ private ClusterAndWaitTime waitOnMetadata(String topic, Integer partition, long if (metadata.getError(topic) != null) { Review Comment: Would it be better to refactor it like this: ``` Errors error = metadata.getError(topic); if (error != null) { cause = error.exception(); } else if (ex.getCause() != null) { cause = ex.getCause(); } else { cause = new KafkaException(METADATA_TIMEOUT_MSG); } throw new TimeoutException(errorMessage, cause); ``` Also, since `ex.getCause() != null` can never be true based on the current `awaitUpdate` implementation, do we need to check for it? ########## clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionalRequestResult.java: ########## @@ -48,15 +50,19 @@ public void done() { } public void await() { - this.await(Long.MAX_VALUE, TimeUnit.MILLISECONDS); + this.await(Long.MAX_VALUE, TimeUnit.MILLISECONDS, () -> new KafkaException("Unknown reason.")); Review Comment: ```suggestion this.await(Long.MAX_VALUE, TimeUnit.MILLISECONDS); ``` -- 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