pvary commented on code in PR #18149:
URL: https://github.com/apache/iceberg/pull/18149#discussion_r4511668548


##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/source/lookup/IcebergFullCachingLookupFunction.java:
##########
@@ -152,23 +175,65 @@ public Collection<RowData> lookup(RowData keyRow) throws 
IOException {
 
   @Override
   public void close() throws Exception {
+    this.closed = true;
+
     try {
-      tableLoader.close();
+      if (reloadTrigger != null) {
+        reloadTrigger.close();
+      }
     } finally {
-      if (cache != null) {
-        cache.close();
+      try {
+        tableLoader.close();
+      } finally {
+        if (cache != null) {
+          cache.close();
+        }
+
+        super.close();
       }
+    }
+  }
 
-      super.close();
+  private CompletableFuture<Void> triggerReload() {
+    if (cache == null || closed) {

Review Comment:
   Shall we check for reloadFailures too, so we are not wasting work?
   ```suggestion
       if (cache == null || closed || reloadFailure != null) {
   ```



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

Reply via email to