ijuma commented on a change in pull request #8705:
URL: https://github.com/apache/kafka/pull/8705#discussion_r431581508



##########
File path: core/src/test/scala/unit/kafka/network/SocketServerTest.scala
##########
@@ -1875,6 +1889,14 @@ class SocketServerTest {
         
cachedCompletedReceives.update(super.completedReceives.asScala.toBuffer)
         cachedCompletedSends.update(super.completedSends.asScala)
         cachedDisconnected.update(super.disconnected.asScala.toBuffer)
+
+        val map: util.Map[String, NetworkReceive] = 
JTestUtils.fieldValue(this, classOf[Selector], "completedReceives")
+        cachedCompletedReceives.currentPollValues.foreach { receive =>
+          val channelOpt = 
Option(super.channel(receive.source)).orElse(Option(super.closingChannel(receive.source)))
+          channelOpt.foreach { channel => map.put(channel.id, receive) }
+        }
+        
cachedCompletedSends.currentPollValues.foreach(super.completedSends.add)
+        cachedDisconnected.currentPollValues.foreach { case (id, state) => 
super.disconnected.put(id, state) }

Review comment:
       Can we add a comment explaining what we're trying to do here? It's not 
clear why we do (for example):
   
   `cachedCompletedSends.update(super.completedSends.asScala)` followed by
   `cachedCompletedSends.currentPollValues.foreach(super.completedSends.add)`
   
   
   




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

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


Reply via email to