You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "chia7712 (via GitHub)" <gi...@apache.org> on 2024/08/03 20:23:39 UTC

Re: [PR] KAFKA-17223: Retrying the call after encoutering UnsupportedVersionException will cause ConcurrentModificationException [kafka]

chia7712 commented on code in PR #16753:
URL: https://github.com/apache/kafka/pull/16753#discussion_r1702879494


##########
clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java:
##########
@@ -1196,16 +1196,24 @@ private long maybeDrainPendingCalls(long now) {
             long pollTimeout = Long.MAX_VALUE;
             log.trace("Trying to choose nodes for {} at {}", pendingCalls, now);
 
-            Iterator<Call> pendingIter = pendingCalls.iterator();
-            while (pendingIter.hasNext()) {
-                Call call = pendingIter.next();
+            List<Call> toRemove = new ArrayList<>();
+            int pendingSize = pendingCalls.size();
+            for (int i = 0; i < pendingSize; i++) {

Review Comment:
   Please add comments to explain why we use this for-loop style



-- 
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-unsubscribe@kafka.apache.org

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