This is an automated email from the ASF dual-hosted git repository.
vinoyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hudi.git
The following commit(s) were added to refs/heads/master by this push:
new 04449f3 [HUDI-743]: Remove FileIOUtils.close() (#1461)
04449f3 is described below
commit 04449f33feb300b99750c52ec37f2561aa644456
Author: Suneel Marthi <[email protected]>
AuthorDate: Sat Mar 28 06:03:15 2020 -0400
[HUDI-743]: Remove FileIOUtils.close() (#1461)
---
.../main/java/org/apache/hudi/metrics/Metrics.java | 3 +--
.../org/apache/hudi/common/util/FileIOUtils.java | 25 ----------------------
2 files changed, 1 insertion(+), 27 deletions(-)
diff --git a/hudi-client/src/main/java/org/apache/hudi/metrics/Metrics.java
b/hudi-client/src/main/java/org/apache/hudi/metrics/Metrics.java
index b6d2f7a..b62279e 100644
--- a/hudi-client/src/main/java/org/apache/hudi/metrics/Metrics.java
+++ b/hudi-client/src/main/java/org/apache/hudi/metrics/Metrics.java
@@ -18,7 +18,6 @@
package org.apache.hudi.metrics;
-import org.apache.hudi.common.util.FileIOUtils;
import org.apache.hudi.config.HoodieWriteConfig;
import org.apache.hudi.exception.HoodieException;
@@ -53,7 +52,7 @@ public class Metrics {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
reporter.report();
- FileIOUtils.close(reporter.getReporter(), true);
+ getReporter().close();
} catch (Exception e) {
e.printStackTrace();
}
diff --git
a/hudi-common/src/main/java/org/apache/hudi/common/util/FileIOUtils.java
b/hudi-common/src/main/java/org/apache/hudi/common/util/FileIOUtils.java
index 65a28b0..f1095b6 100644
--- a/hudi-common/src/main/java/org/apache/hudi/common/util/FileIOUtils.java
+++ b/hudi-common/src/main/java/org/apache/hudi/common/util/FileIOUtils.java
@@ -18,10 +18,7 @@
package org.apache.hudi.common.util;
-import javax.annotation.Nullable;
-
import java.io.ByteArrayOutputStream;
-import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -94,26 +91,4 @@ public class FileIOUtils {
out.flush();
out.close();
}
-
- /**
- * Closes a {@link Closeable}, with control over whether an {@code
IOException} may be thrown.
- * @param closeable the {@code Closeable} object to be closed, or null,
- * in which case this method does nothing.
- * @param swallowIOException if true, don't propagate IO exceptions thrown
by the {@code close} methods.
- *
- * @throws IOException if {@code swallowIOException} is false and {@code
close} throws an {@code IOException}.
- */
- public static void close(@Nullable Closeable closeable, boolean
swallowIOException)
- throws IOException {
- if (closeable == null) {
- return;
- }
- try {
- closeable.close();
- } catch (IOException e) {
- if (!swallowIOException) {
- throw e;
- }
- }
- }
}