FrankYang0529 commented on code in PR #19793:
URL: https://github.com/apache/kafka/pull/19793#discussion_r2105694458
##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1006,7 +1026,7 @@ class ReplicaManager(val config: KafkaConfig,
LogAppendInfo.UNKNOWN_LOG_APPEND_INFO.logStartOffset
)
}
- responseCallback(responseStatus)
+ responseCallback(responseStatus.asJava)
Review Comment:
ditto
```scala
val responseStatus = new util.HashMap[TopicIdPartition,
PartitionResponse]()
entries.foreach { case (topicIdPartition, _) =>
responseStatus.put(topicIdPartition, new PartitionResponse(
Errors.INVALID_REQUIRED_ACKS,
LogAppendInfo.UNKNOWN_LOG_APPEND_INFO.firstOffset,
RecordBatch.NO_TIMESTAMP,
LogAppendInfo.UNKNOWN_LOG_APPEND_INFO.logStartOffset
))
}
responseCallback(responseStatus)
```
##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -989,13 +1009,13 @@ class ReplicaManager(val config: KafkaConfig,
} else {
// we can respond immediately
val produceResponseStatus = initialProduceStatus.map { case (k, status)
=> k -> status.responseStatus }
- responseCallback(produceResponseStatus)
+ responseCallback(produceResponseStatus.asJava)
Review Comment:
We use `initialProduceStatus` to build a Scala map and transfer to Java.
Probably, we can build a Java map directly, so we can avoid `asJava` here.
```scala
val produceResponseStatus = new util.HashMap[TopicIdPartition,
PartitionResponse]()
initialProduceStatus.foreach { case (k, status) =>
produceResponseStatus.put(k, status.responseStatus()) }
responseCallback(produceResponseStatus)
```
--
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]