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 b10cd3e533..49e8cfab51 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 @@ -293,7 +293,7 @@ class LevelDBStore extends LockableServiceSupport with BrokerServiceAware with P try { AnnotatedMBean.registerMBean(brokerService.getManagementContext, new LevelDBStoreView(this), objectName) if( java.lang.Boolean.getBoolean("org.apache.activemq.leveldb.test") ) { - val name = new ObjectName(objectName.toString + ",test=test") + val name = new ObjectName(objectName.toString + ",view=Test") AnnotatedMBean.registerMBean(brokerService.getManagementContext, new LevelDBStoreTest(this), name) } } catch { @@ -353,7 +353,7 @@ class LevelDBStore extends LockableServiceSupport with BrokerServiceAware with P if(brokerService!=null && brokerService.isUseJmx){ brokerService.getManagementContext().unregisterMBean(objectName); if( java.lang.Boolean.getBoolean("org.apache.activemq.leveldb.test") ) - brokerService.getManagementContext().unregisterMBean(new ObjectName(objectName.toString+",test=test")); + brokerService.getManagementContext().unregisterMBean(new ObjectName(objectName.toString+",view=Test")); } info("Stopped "+this) } diff --git a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/SlaveLevelDBStore.scala b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/SlaveLevelDBStore.scala index 0eddb0fc42..cbacc77233 100644 --- a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/SlaveLevelDBStore.scala +++ b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/SlaveLevelDBStore.scala @@ -16,7 +16,7 @@ */ package org.apache.activemq.leveldb.replicated -import org.apache.activemq.leveldb.{LevelDBClient, LevelDBStore} +import org.apache.activemq.leveldb.{LevelDBStoreTest, LevelDBClient, LevelDBStore} import org.apache.activemq.util.ServiceStopper import java.util import org.fusesource.hawtdispatch._ @@ -30,6 +30,8 @@ import FileSupport._ import java.io.{IOException, RandomAccessFile, File} import scala.beans.BeanProperty import java.util.concurrent.{CountDownLatch, TimeUnit} +import javax.management.ObjectName +import org.apache.activemq.broker.jmx.AnnotatedMBean object SlaveLevelDBStore extends Log @@ -79,10 +81,18 @@ class SlaveLevelDBStore extends LevelDBStore with ReplicatedLevelDBStoreTrait { db.client.dirtyIndexFile.recursiveDelete db.client.plistIndexFile.recursiveDelete start_slave_connections + + if( java.lang.Boolean.getBoolean("org.apache.activemq.leveldb.test") ) { + val name = new ObjectName(objectName.toString + ",view=Test") + AnnotatedMBean.registerMBean(brokerService.getManagementContext, new LevelDBStoreTest(this), name) + } } var stopped = false override def doStop(stopper: ServiceStopper) = { + if( java.lang.Boolean.getBoolean("org.apache.activemq.leveldb.test") ) + brokerService.getManagementContext().unregisterMBean(new ObjectName(objectName.toString+",view=Test")); + val latch = new CountDownLatch(1) stop_connections(^{ latch.countDown