lbradstreet commented on a change in pull request #10620:
URL: https://github.com/apache/kafka/pull/10620#discussion_r633028169



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/producer/internals/IncompleteBatches.java
##########
@@ -51,6 +51,14 @@ public void remove(ProducerBatch batch) {
         }
     }
 
+    public Iterable<ProduceRequestResult> requestResults() {
+        synchronized (incomplete) {
+            ArrayList<ProduceRequestResult> results = new 
ArrayList<>(this.incomplete.size());
+            this.incomplete.forEach(incomplete -> 
results.add(incomplete.produceFuture));
+            return results;

Review comment:
       I think I had a bit of a blind spot because I wanted to preallocate the 
ArrayList to be the correct size. I think streams is able to do that though. 
I'm happy to convert it back if it's nicer.




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