diff --git a/metrics-core/src/main/java/com/codahale/metrics/ScheduledReporter.java b/metrics-core/src/main/java/com/codahale/metrics/ScheduledReporter.java index 4723cdfc8c..bb7ad86c15 100644 --- a/metrics-core/src/main/java/com/codahale/metrics/ScheduledReporter.java +++ b/metrics-core/src/main/java/com/codahale/metrics/ScheduledReporter.java @@ -220,10 +220,13 @@ public void stop() { executor.shutdown(); // Disable new tasks from being submitted } - try { - report(); // Report metrics one last time - } catch (Exception e) { - LOG.warn("Final reporting of metrics failed.", e); + if (this.scheduledFuture != null) { + // Reporter started, try to report metrics one last time + try { + report(); + } catch (Exception e) { + LOG.warn("Final reporting of metrics failed.", e); + } } if (shutdownExecutorOnStop) {