MehulBatra commented on code in PR #1552:
URL: https://github.com/apache/fluss/pull/1552#discussion_r2292958587


##########
fluss-lake/fluss-lake-iceberg/src/main/java/com/alibaba/fluss/lake/iceberg/tiering/IcebergLakeWriter.java:
##########
@@ -107,6 +161,15 @@ public IcebergWriteResult complete() throws IOException {
     @Override
     public void close() throws IOException {
         try {
+            if (compactionFuture != null && !compactionFuture.isDone()) {
+                compactionFuture.cancel(true);
+            }
+
+            if (compactionExecutor != null) {
+                compactionExecutor.shutdownNow();
+                compactionExecutor.awaitTermination(5, TimeUnit.SECONDS);

Review Comment:
   complete(): No NPE when auto-maintenance is disabled or if compaction was 
never scheduled; compaction result is simply null.
   close(): No NPE from compactionExecutor when it’s null, and threads are 
cleaned up properly by shutting down the executor first.
   Using a completed future when auto-maintenance is off ensures consistent 
behavior and simplifies future handling, but the explicit null checks keep it 
safe even if that initialization is removed later.
   



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

Reply via email to