diff --git a/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryMessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryMessageStore.java index a54634d962..0684142546 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryMessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryMessageStore.java @@ -77,7 +77,7 @@ public class MemoryMessageStore implements MessageStore{ public void removeMessage(MessageId msgId) throws IOException{ synchronized(messageTable){ messageTable.remove(msgId); - if(lastBatchId!=null && lastBatchId.equals(msgId)){ + if((lastBatchId!=null && lastBatchId.equals(msgId)) || messageTable.isEmpty()){ lastBatchId=null; } }