From 1db8db515b1cbcc4d62fd3bfcf70b41d915c7814 Mon Sep 17 00:00:00 2001 From: jackylee-ch Date: Thu, 13 Oct 2022 13:13:45 +0800 Subject: [PATCH] fix: remove temp directory --- .../core/src/main/java/com/intel/oap/vectorized/JniUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/native-sql-engine/core/src/main/java/com/intel/oap/vectorized/JniUtils.java b/native-sql-engine/core/src/main/java/com/intel/oap/vectorized/JniUtils.java index 565c1dff9..4579be179 100644 --- a/native-sql-engine/core/src/main/java/com/intel/oap/vectorized/JniUtils.java +++ b/native-sql-engine/core/src/main/java/com/intel/oap/vectorized/JniUtils.java @@ -82,7 +82,8 @@ private JniUtils(String _tmp_dir) throws IOException, IllegalAccessException, Il } else { Path folder = Paths.get(_tmp_dir); Path path = Files.createTempDirectory(folder, "spark_columnar_plugin_"); - FileUtils.forceDeleteOnExit(new File(path.toUri())); + Runtime.getRuntime().addShutdownHook( + new Thread(() -> FileUtils.deleteQuietly(path.toFile()))); tmp_dir = path.toAbsolutePath().toString(); } }