diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java index 8b68073747..bfad9f6bb2 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java @@ -182,8 +182,12 @@ public class KahaDBStore extends MessageDatabase implements PersistenceAdapter { @Override public void doStop(ServiceStopper stopper) throws Exception { - this.queueSemaphore.drainPermits(); - this.topicSemaphore.drainPermits(); + if (this.queueSemaphore != null) { + this.queueSemaphore.drainPermits(); + } + if (this.topicSemaphore != null) { + this.topicSemaphore.drainPermits(); + } if (this.queueExecutor != null) { this.queueExecutor.shutdownNow(); }