From b6703d6bd7b65cdd2175616bec59bcd1915f9a9c Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Fri, 17 May 2013 15:47:04 +0000 Subject: [PATCH] Fixes failing ThreeBrokerVirtualTopicNetwork test associated /w AMQ-4296 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1483878 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/leveldb/LevelDBStore.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBStore.scala b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBStore.scala index 42459a5fbf..8e07b73851 100644 --- a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBStore.scala +++ b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBStore.scala @@ -255,6 +255,14 @@ class LevelDBStore extends LockableServiceSupport with BrokerServiceAware with P } } } + + // Remove topics that don't have subs.. + for( (name, topic) <- topics.toArray ) { + if( topic.subscription_count == 0 ) { + removeTopicMessageStore(name) + } + } + debug("started") } @@ -754,6 +762,10 @@ class LevelDBStore extends LockableServiceSupport with BrokerServiceAware with P super.asyncAddQueueMessage(context, message, false) } + def subscription_count = subscriptions.synchronized { + subscriptions.size + } + def gcPosition:Option[(Long, Long)] = { var pos = lastSeq.get() subscriptions.synchronized {