Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
Expand Down Expand Up @@ -67,9 +67,9 @@ public ConfigurationSource getConf() {

@Override
public void run() {
publishReport();
if (!executor.isShutdown() &&
(context.getState() != DatanodeStates.SHUTDOWN)) {
publishReport();
executor.schedule(this,
getReportFrequency(), TimeUnit.MILLISECONDS);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
Expand Down Expand Up @@ -107,6 +107,9 @@ public void testScheduledReport() throws InterruptedException {
Thread.sleep(100);
Assert.assertEquals(2, ((DummyReportPublisher) publisher).getReportCount);
executorService.shutdown();
// After executor shutdown, no new reports should be published
Thread.sleep(100);
Assert.assertEquals(2, ((DummyReportPublisher) publisher).getReportCount);
}

@Test
Expand All @@ -122,7 +125,9 @@ public void testPublishReport() throws InterruptedException {
executorService.shutdown();
Assert.assertEquals(1, ((DummyReportPublisher) publisher).getReportCount);
verify(dummyContext, times(1)).addReport(null);

// After executor shutdown, no new reports should be published
Thread.sleep(100);
Assert.assertEquals(1, ((DummyReportPublisher) publisher).getReportCount);
}

@Test
Expand Down