Only register the leveldb store MBeans in JMX if jmx is enabled on the broker.

This commit is contained in:
Hiram Chirino 2013-10-30 15:34:29 -04:00
parent 2a59294909
commit 17415ceecd
2 changed files with 4 additions and 4 deletions

View File

@ -217,7 +217,7 @@ class LevelDBStore extends LockableServiceSupport with BrokerServiceAware with P
debug("starting")
// Expose a JMX bean to expose the status of the store.
if(brokerService!=null){
if(brokerService!=null && brokerService.isUseJmx){
try {
AnnotatedMBean.registerMBean(brokerService.getManagementContext, new LevelDBStoreView(this), objectName)
} catch {
@ -274,7 +274,7 @@ class LevelDBStore extends LockableServiceSupport with BrokerServiceAware with P
def doStop(stopper: ServiceStopper): Unit = {
db.stop
if(brokerService!=null){
if(brokerService!=null && brokerService.isUseJmx){
brokerService.getManagementContext().unregisterMBean(objectName);
}
info("Stopped "+this)

View File

@ -156,7 +156,7 @@ class ElectingLevelDBStore extends ProxyLevelDBStore {
def init() {
if(brokerService!=null){
if(brokerService!=null && brokerService.isUseJmx){
try {
AnnotatedMBean.registerMBean(brokerService.getManagementContext, new ReplicatedLevelDBStoreView(this), objectName)
} catch {
@ -269,7 +269,7 @@ class ElectingLevelDBStore extends ProxyLevelDBStore {
}
protected def doStop(stopper: ServiceStopper) {
if(brokerService!=null){
if(brokerService!=null && brokerService.isUseJmx){
brokerService.getManagementContext().unregisterMBean(objectName);
}
zk_group.close