shanzi commented on code in PR #16545:
URL: https://github.com/apache/iceberg/pull/16545#discussion_r3328179183
##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/source/reader/ArrayPoolDataIteratorBatcher.java:
##########
@@ -118,7 +131,28 @@ public void close() throws IOException {
inputIterator.close();
}
+ /**
+ * Polls for an available entry from the pool. If a wakeup flag is set,
uses non-blocking
+ * tryPollEntry with sleep-retry loop so the thread can be interrupted
during cancellation.
+ * Returns null if the wakeup flag is set, indicating that the reader
should stop processing.
+ */
private T[] getCachedEntry() {
+ if (wakeup != null) {
+ while (!wakeup.get()) {
+ T[] entry = pool.tryPollEntry();
+ if (entry != null) {
+ return entry;
+ }
+ try {
+ Thread.sleep(POLL_RETRY_INTERVAL_MS);
Review Comment:
Thanks for review.
It's a little bit hard to pass the wakeup flag without changing to many
interfaces. I'll try to find a more elegant way.
--
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]