diff --git a/logstash-core/src/main/java/org/logstash/common/io/DeadLetterQueueWriter.java b/logstash-core/src/main/java/org/logstash/common/io/DeadLetterQueueWriter.java index 342c3ce751e..b321005b49b 100644 --- a/logstash-core/src/main/java/org/logstash/common/io/DeadLetterQueueWriter.java +++ b/logstash-core/src/main/java/org/logstash/common/io/DeadLetterQueueWriter.java @@ -254,7 +254,10 @@ public void close() { } try { - flushScheduler.shutdown(); + // flushScheduler is null only if it's not explicitly started, which happens only in tests. + if (flushScheduler != null) { + flushScheduler.shutdown(); + } } catch (Exception e) { logger.warn("Unable shutdown flush scheduler, ignoring", e); }