File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
metrics-core/src/main/java/com/codahale/metrics
metrics-graphite/src/test/java/com/codahale/metrics/graphite Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -220,10 +220,13 @@ public void stop() {
220
220
executor .shutdown (); // Disable new tasks from being submitted
221
221
}
222
222
223
- try {
224
- report (); // Report metrics one last time
225
- } catch (Exception e ) {
226
- LOG .warn ("Final reporting of metrics failed." , e );
223
+ if (this .scheduledFuture != null ) {
224
+ // Reporter started, try to report metrics one last time
225
+ try {
226
+ report ();
227
+ } catch (Exception e ) {
228
+ LOG .warn ("Final reporting of metrics failed." , e );
229
+ }
227
230
}
228
231
229
232
if (shutdownExecutorOnStop ) {
Original file line number Diff line number Diff line change @@ -445,6 +445,7 @@ public void closesConnectionIfGraphiteIsUnavailable() throws Exception {
445
445
446
446
@ Test
447
447
public void closesConnectionOnReporterStop () throws Exception {
448
+ reporter .start (1 , TimeUnit .SECONDS );
448
449
reporter .stop ();
449
450
450
451
final InOrder inOrder = inOrder (graphite );
You can’t perform that action at this time.
0 commit comments