This is an automated email from the ASF dual-hosted git repository. leesf 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 09fd6f6 [HUDI-800] Fix Metrics getReporter().close() throws NPE. (#1529) 09fd6f6 is described below commit 09fd6f64c527e6a822c4e17dc4e61b8fdee28189 Author: lw0090 <lw309637...@gmail.com> AuthorDate: Sun Apr 19 21:33:07 2020 +0800 [HUDI-800] Fix Metrics getReporter().close() throws NPE. (#1529) --- hudi-client/src/main/java/org/apache/hudi/metrics/Metrics.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 b62279e..5980911 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 @@ -52,9 +52,11 @@ public class Metrics { Runtime.getRuntime().addShutdownHook(new Thread(() -> { try { reporter.report(); - getReporter().close(); + if (getReporter() != null) { + getReporter().close(); + } } catch (Exception e) { - e.printStackTrace(); + LOG.warn("Error while closing reporter", e); } })); }