Skip to content

Commit b219f48

Browse files
committed
[core] FileIO.close should throw IOException
1 parent 71dc274 commit b219f48

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ default FileStatus[] listDirectories(Path path) throws IOException {
237237
* and do not have the ability to close them.
238238
*/
239239
@Override
240-
default void close() {}
240+
default void close() throws IOException {}
241241

242242
// -------------------------------------------------------------------------
243243
// utils

paimon-core/src/main/java/org/apache/paimon/rest/RESTTokenFileIO.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.apache.paimon.fs.SeekableInputStream;
2828
import org.apache.paimon.options.Options;
2929
import org.apache.paimon.rest.responses.GetTableTokenResponse;
30+
import org.apache.paimon.utils.IOUtils;
3031
import org.apache.paimon.utils.ThreadUtils;
3132

3233
import org.apache.paimon.shade.caffeine2.com.github.benmanes.caffeine.cache.Cache;
@@ -53,11 +54,7 @@ public class RESTTokenFileIO implements FileIO {
5354
.expireAfterAccess(30, TimeUnit.MINUTES)
5455
.maximumSize(100)
5556
.removalListener(
56-
(ignored, value, cause) -> {
57-
if (value != null) {
58-
((FileIO) value).close();
59-
}
60-
})
57+
(ignored, value, cause) -> IOUtils.closeQuietly((FileIO) value))
6158
.scheduler(
6259
Scheduler.forScheduledExecutorService(
6360
Executors.newSingleThreadScheduledExecutor(

0 commit comments

Comments
 (0)