diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java index 2e17a69083..6a98ccea2b 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java @@ -1739,6 +1739,7 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe LOG.trace("gc candidates: " + gcCandidateSet); LOG.trace("ackMessageFileMap: " + metadata.ackMessageFileMap); } + boolean ackMessageFileMapMod = false; Iterator candidates = gcCandidateSet.iterator(); while (candidates.hasNext()) { Integer candidate = candidates.next(); @@ -1752,7 +1753,7 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe } } if (gcCandidateSet.contains(candidate)) { - metadata.ackMessageFileMap.remove(candidate); + ackMessageFileMapMod |= (metadata.ackMessageFileMap.remove(candidate) != null); } else { if (LOG.isTraceEnabled()) { LOG.trace("not removing data file: " + candidate @@ -1767,7 +1768,6 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe LOG.debug("Cleanup removing the data files: " + gcCandidateSet); } journal.removeDataFiles(gcCandidateSet); - boolean ackMessageFileMapMod = false; for (Integer candidate : gcCandidateSet) { for (Set ackFiles : metadata.ackMessageFileMap.values()) { ackMessageFileMapMod |= ackFiles.remove(candidate);