ScheduledReporter implements Closeable, Reporter { public void stop() { if (shutdownExecutorOnStop) { executor.shutdown(); } try { report(); } catch (Exception e) { LOG.warn("Final reporting of metrics failed.", e); } if (shutdownExecutorOnStop) { try { if (!executor.awaitTermination(1, TimeUnit.SECONDS)) { executor.shutdownNow(); if (!executor.awaitTermination(1, TimeUnit.SECONDS)) { LOG.warn("ScheduledExecutorService did not terminate."); } } } catch (InterruptedException ie) { executor.shutdownNow(); Thread.currentThread().interrupt(); } } else { cancelScheduledFuture(); } } protected  ScheduledReporter(MetricRegistry registry,
                                String name,
                                MetricFilter filter,
                                TimeUnit rateUnit,
                                TimeUnit durationUnit); protected  ScheduledReporter(MetricRegistry registry,
                                String name,
                                MetricFilter filter,
                                TimeUnit rateUnit,
                                TimeUnit durationUnit,
                                ScheduledExecutorService executor); protected  ScheduledReporter(MetricRegistry registry,
                                String name,
                                MetricFilter filter,
                                TimeUnit rateUnit,
                                TimeUnit durationUnit,
                                ScheduledExecutorService executor,
                                boolean shutdownExecutorOnStop); protected  ScheduledReporter(MetricRegistry registry,
                                String name,
                                MetricFilter filter,
                                TimeUnit rateUnit,
                                TimeUnit durationUnit,
                                ScheduledExecutorService executor,
                                boolean shutdownExecutorOnStop,
                                Set<MetricAttribute> disabledMetricAttributes); void start(long period, TimeUnit unit); synchronized void start(long initialDelay, long period, TimeUnit unit); void stop(); @Override void close(); void report(); @SuppressWarnings("rawtypes") abstract void report(SortedMap<String, Gauge> gauges,
                                SortedMap<String, Counter> counters,
                                SortedMap<String, Histogram> histograms,
                                SortedMap<String, Meter> meters,
                                SortedMap<String, Timer> timers);  }
@Test public void shouldNotFailOnStopIfReporterWasNotStared() { for (ScheduledReporter reporter : reporters) { reporter.stop(); } }