Avoid submitting a job if executor is shutdown

There’s still a possiblilty of a race condition and we could catch and handle the exception, but this should reduce the noise a bit.
This commit is contained in:
Tyler Benson 2019-10-18 11:24:33 -07:00
parent 53962a3045
commit 296916a393
1 changed files with 1 additions and 1 deletions

View File

@ -171,7 +171,7 @@ public class DDAgentWriter implements Writer {
}
private void scheduleFlush() {
if (flushFrequencySeconds > 0) {
if (flushFrequencySeconds > 0 && !scheduledWriterExecutor.isShutdown()) {
final ScheduledFuture<?> previous =
flushSchedule.getAndSet(
scheduledWriterExecutor.schedule(flushTask, flushFrequencySeconds, SECONDS));