m1a2st commented on code in PR #19793:
URL: https://github.com/apache/kafka/pull/19793#discussion_r2108484602


##########
core/src/test/scala/kafka/server/LocalLeaderEndPointTest.scala:
##########
@@ -271,9 +271,10 @@ class LocalLeaderEndPointTest extends Logging {
                             origin: AppendOrigin = AppendOrigin.CLIENT,
                             requiredAcks: Short = -1): 
CallbackResult[PartitionResponse] = {
     val result = new CallbackResult[PartitionResponse]()
-    def appendCallback(responses: scala.collection.Map[TopicIdPartition, 
PartitionResponse]): Unit = {
-      val response = responses.get(partition)
-      assertTrue(response.isDefined)
+    def appendCallback(responses: java.util.Map[TopicIdPartition, 
PartitionResponse]): Unit = {
+      val response = Optional.ofNullable(responses.get(partition))
+
+      assertTrue(response.isPresent)
       result.fire(response.get)

Review Comment:
   ```suggestion
         val response = responses.get(partition)
         assertNotNull(response)
         result.fire(response)
   ```



##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -2990,9 +2990,9 @@ class ReplicaManagerTest {
                             requiredAcks: Short = -1): 
CallbackResult[PartitionResponse] = {
     val result = new CallbackResult[PartitionResponse]()
     val topicIdPartition = new TopicIdPartition(topicId, partition)
-    def appendCallback(responses: Map[TopicIdPartition, PartitionResponse]): 
Unit = {
-      val response = responses.get(topicIdPartition)
-      assertTrue(response.isDefined)
+    def appendCallback(responses: util.Map[TopicIdPartition, 
PartitionResponse]): Unit = {
+      val response = 
java.util.Optional.ofNullable(responses.get(topicIdPartition))
+      assertTrue(response.isPresent)
       result.fire(response.get)

Review Comment:
   ```suggestion
         val response = responses.get(topicIdPartition)
         assertNotNull(response)
         result.fire(response)
   ```



##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -983,23 +1003,25 @@ class ReplicaManager(val config: KafkaConfig,
       delayedProducePurgatory.tryCompleteElseWatch(delayedProduce, 
producerRequestKeys.asJava)
     } else {
       // we can respond immediately
-      val produceResponseStatus = initialProduceStatus.map { case (k, status) 
=> k -> status.responseStatus }
+      val produceResponseStatus = new util.HashMap[TopicIdPartition, 
PartitionResponse]
+      initialProduceStatus.foreach { case (k, status) => k -> 
produceResponseStatus.put(k, status.responseStatus) }

Review Comment:
   ```suggestion
         val produceResponseStatus = initialProduceStatus.map { case (k, 
status) =>
           k -> status.responseStatus
         }.asJava
   ```



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