jasonk000 commented on a change in pull request #11722: URL: https://github.com/apache/kafka/pull/11722#discussion_r799796771
########## File path: clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java ########## @@ -448,40 +448,48 @@ public ReadyCheckResult ready(Cluster cluster, long nowMs) { boolean exhausted = this.free.queued() > 0; for (Map.Entry<TopicPartition, Deque<ProducerBatch>> entry : this.batches.entrySet()) { Deque<ProducerBatch> deque = entry.getValue(); + + final ProducerBatch batch; + final long waitedTimeMs; + final boolean backingOff; + final boolean full; + + // Collect as little as possible inside critical region, determine outcome after release synchronized (deque) { - // When producing to a large number of partitions, this path is hot and deques are often empty. - // We check whether a batch exists first to avoid the more expensive checks whenever possible. Review comment: I attempted to capture the sentiment with this comment, given the re-flowed logic: ``` // Collect as little as possible inside critical region, determine outcome after release ``` I'll add something more descriptive. -- 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