smarthi commented on a change in pull request #1159: [HUDI-479] Eliminate or
Minimize use of Guava if possible
URL: https://github.com/apache/incubator-hudi/pull/1159#discussion_r399324299
##########
File path:
hudi-common/src/main/java/org/apache/hudi/common/util/FileIOUtils.java
##########
@@ -91,4 +94,29 @@ public static void writeStringToFile(String str, String
filePath) throws IOExcep
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;
+ }
+ }
+ }
+
+ /** Maximum loop count when creating temp directories. */
+ private static final int TEMP_DIR_ATTEMPTS = 10000;
Review comment:
I think we do - this is getting called in Metrics.java - but I guess it
could be dispensed with if we modify Metrics.java - haven't looked at it
closely enough - will take that up.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services