junrao commented on code in PR #13463:
URL: https://github.com/apache/kafka/pull/13463#discussion_r1156466725


##########
core/src/main/scala/kafka/common/InterBrokerSender.scala:
##########
@@ -45,10 +45,15 @@ abstract class InterBrokerSendThread(
 
   private val unsentRequests = new UnsentRequests
 
-  def generateRequests(): Iterable[RequestAndCompletionHandler]
+  private val requestManagers = new ArrayList[InterBrokerRequestManager]()

Review Comment:
   Regarding synchronization, it seems that it's possible for `requestManagers` 
to be iterated through `drainGeneratedRequests()` while it's being modified 
through `addRequestManager()` concurrently. In that case, ArrayList could throw 
ConcurrentModificationException.
   
   Regarding visibility, since there is no memory barrier for 
`requestManagers`, if one thread changes `requestManagers`, there is no 
guarantee that another thread will see the latest value inside 
`requestManagers`.
   



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