scwhittle commented on code in PR #29082:
URL: https://github.com/apache/beam/pull/29082#discussion_r1487774957
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/streaming/ActiveWorkState.java:
##########
@@ -136,79 +158,57 @@ synchronized ActivateWorkResult
activateWorkForKey(ShardedKey shardedKey, Work w
}
// Check to see if we have this work token queued.
- // This set is for adding remove-able WorkItems if they exist in the
workQueue. We add them to
- // this set since a ConcurrentModificationException will be thrown if we
modify the workQueue
- // and then resume iteration.
- Set<WorkId> queuedWorkToRemove = new HashSet<>();
- for (Work queuedWork : workQueue) {
+ Iterator<Work> workIterator = workQueue.iterator();
+ while (workIterator.hasNext()) {
Review Comment:
nit: for loop seems a little nicer to scope the iterator
for(Iterator<Work> workIterator = workQueue.iterator();
workIterator.hasNext();) {
Work queuedWork = workIterator.next();
}
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]