diff --git a/paimon-common/src/main/java/org/apache/paimon/utils/FileDeletionThreadPool.java b/paimon-common/src/main/java/org/apache/paimon/utils/FileDeletionThreadPool.java index 51b208930201..07b0f5d320c2 100644 --- a/paimon-common/src/main/java/org/apache/paimon/utils/FileDeletionThreadPool.java +++ b/paimon-common/src/main/java/org/apache/paimon/utils/FileDeletionThreadPool.java @@ -44,12 +44,15 @@ public static synchronized ThreadPoolExecutor getExecutorService(int threadNum) } private static ThreadPoolExecutor createCachedThreadPool(int threadNum) { - return new ThreadPoolExecutor( - 0, - threadNum, - 1, - TimeUnit.MINUTES, - new LinkedBlockingQueue<>(), - newDaemonThreadFactory("DELETE-FILE-THREAD-POOL")); + ThreadPoolExecutor executor = + new ThreadPoolExecutor( + threadNum, + threadNum, + 1, + TimeUnit.MINUTES, + new LinkedBlockingQueue<>(), + newDaemonThreadFactory("DELETE-FILE-THREAD-POOL")); + executor.allowCoreThreadTimeOut(true); + return executor; } }