nastra commented on code in PR #5887:
URL: https://github.com/apache/iceberg/pull/5887#discussion_r991035716
##########
core/src/main/java/org/apache/iceberg/util/ParallelIterable.java:
##########
@@ -81,13 +81,18 @@ private ParallelIterator(
@Override
public void close() {
+ // close first, avoid new task submit
+ this.closed = true;
+
// cancel background tasks
for (int i = 0; i < taskFutures.length; i += 1) {
- if (taskFutures[i] != null && !taskFutures[i].isDone()) {
- taskFutures[i].cancel(true);
+ Future<?> taskFuture = taskFutures[i];
+ if (taskFuture != null && !taskFuture.isDone()) {
+ taskFuture.cancel(true);
}
}
- this.closed = true;
+ // clean queue
+ this.queue.clear();
Review Comment:
@rdblue do you remember maybe why the queue wasn't cleared originally when
close was called?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]