jackye1995 commented on a change in pull request #2921:
URL: https://github.com/apache/iceberg/pull/2921#discussion_r707786029



##########
File path: 
spark3/src/main/java/org/apache/iceberg/spark/procedures/ExpireSnapshotsProcedure.java
##########
@@ -90,7 +96,14 @@ public StructType outputType() {
       if (retainLastNum != null) {
         action.retainLast(retainLastNum);
       }
-
+      if (numThreads != null && numThreads > 0) {
+        action.executeDeleteWith(Executors.newFixedThreadPool(numThreads, 
runnable -> {
+          Thread thread = new Thread(runnable);
+          thread.setName("expire-snapshot-" + 
deleteThreadsIndex.getAndIncrement());
+          thread.setDaemon(true); // daemon threads will be terminated 
abruptly when the JVM exits

Review comment:
       if we use exiting executor service, I think this line is not needed? 
Based on guava doc 
https://guava.dev/releases/19.0/api/docs/com/google/common/util/concurrent/MoreExecutors.html#getExitingExecutorService(java.util.concurrent.ThreadPoolExecutor):
   
   > Converts the given ThreadPoolExecutor into an ExecutorService that exits 
when the application is complete. It does so by using daemon threads and adding 
a shutdown hook to wait for their completion. 




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