You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by lz...@apache.org on 2025/02/11 03:40:38 UTC
(paimon) branch master updated: [core] FileIO.close should throw IOException
This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new b219f48bab [core] FileIO.close should throw IOException
b219f48bab is described below
commit b219f48bab57f57fa7f431b0e69ba327d6837140
Author: JingsongLi <ji...@gmail.com>
AuthorDate: Tue Feb 11 11:40:29 2025 +0800
[core] FileIO.close should throw IOException
---
paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java | 2 +-
.../src/main/java/org/apache/paimon/rest/RESTTokenFileIO.java | 7 ++-----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java b/paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java
index 9810013898..597df53ce8 100644
--- a/paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java
+++ b/paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java
@@ -237,7 +237,7 @@ public interface FileIO extends Serializable, Closeable {
* and do not have the ability to close them.
*/
@Override
- default void close() {}
+ default void close() throws IOException {}
// -------------------------------------------------------------------------
// utils
diff --git a/paimon-core/src/main/java/org/apache/paimon/rest/RESTTokenFileIO.java b/paimon-core/src/main/java/org/apache/paimon/rest/RESTTokenFileIO.java
index 220d0eaaee..372051e169 100644
--- a/paimon-core/src/main/java/org/apache/paimon/rest/RESTTokenFileIO.java
+++ b/paimon-core/src/main/java/org/apache/paimon/rest/RESTTokenFileIO.java
@@ -27,6 +27,7 @@ import org.apache.paimon.fs.PositionOutputStream;
import org.apache.paimon.fs.SeekableInputStream;
import org.apache.paimon.options.Options;
import org.apache.paimon.rest.responses.GetTableTokenResponse;
+import org.apache.paimon.utils.IOUtils;
import org.apache.paimon.utils.ThreadUtils;
import org.apache.paimon.shade.caffeine2.com.github.benmanes.caffeine.cache.Cache;
@@ -53,11 +54,7 @@ public class RESTTokenFileIO implements FileIO {
.expireAfterAccess(30, TimeUnit.MINUTES)
.maximumSize(100)
.removalListener(
- (ignored, value, cause) -> {
- if (value != null) {
- ((FileIO) value).close();
- }
- })
+ (ignored, value, cause) -> IOUtils.closeQuietly((FileIO) value))
.scheduler(
Scheduler.forScheduledExecutorService(
Executors.newSingleThreadScheduledExecutor(