mirror of https://github.com/apache/activemq.git
https://issues.apache.org/activemq/browse/AMQ-2306 - jmx for slave brokers
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@833395 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f1fa8f911d
commit
b3873fb3e4
|
@ -440,6 +440,9 @@ public class BrokerService implements Service {
|
|||
});
|
||||
}
|
||||
processHelperProperties();
|
||||
if (isUseJmx()) {
|
||||
startManagementContext();
|
||||
}
|
||||
getPersistenceAdapter().setUsageManager(getProducerSystemUsage());
|
||||
getPersistenceAdapter().setBrokerName(getBrokerName());
|
||||
LOG.info("Using Persistence Adapter: " + getPersistenceAdapter());
|
||||
|
@ -451,12 +454,15 @@ public class BrokerService implements Service {
|
|||
addShutdownHook();
|
||||
getBroker().start();
|
||||
if (isUseJmx()) {
|
||||
getManagementContext().start();
|
||||
if (!getManagementContext().isConnectorStarted()) {
|
||||
// try to restart management context
|
||||
// typical for slaves that use the same ports as master
|
||||
managementContext.stop();
|
||||
startManagementContext();
|
||||
}
|
||||
ManagedRegionBroker managedBroker = (ManagedRegionBroker) regionBroker;
|
||||
managedBroker.setContextBroker(broker);
|
||||
adminView = new BrokerView(this, managedBroker);
|
||||
ObjectName objectName = getBrokerObjectName();
|
||||
AnnotatedMBean.registerMBean(getManagementContext(), adminView, objectName);
|
||||
adminView.setBroker(managedBroker);
|
||||
}
|
||||
BrokerRegistry.getInstance().bind(getBrokerName(), this);
|
||||
// see if there is a MasterBroker service and if so, configure
|
||||
|
@ -1896,6 +1902,13 @@ public class BrokerService implements Service {
|
|||
slaveStartSignal.countDown();
|
||||
}
|
||||
|
||||
protected void startManagementContext() throws Exception {
|
||||
getManagementContext().start();
|
||||
adminView = new BrokerView(this, null);
|
||||
ObjectName objectName = getBrokerObjectName();
|
||||
AnnotatedMBean.registerMBean(getManagementContext(), adminView, objectName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start all transport and network connections, proxies and bridges
|
||||
*
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.activemq.network.NetworkConnector;
|
|||
*/
|
||||
public class BrokerView implements BrokerViewMBean {
|
||||
|
||||
final ManagedRegionBroker broker;
|
||||
ManagedRegionBroker broker;
|
||||
private final BrokerService brokerService;
|
||||
private final AtomicInteger sessionIdCounter = new AtomicInteger(0);
|
||||
|
||||
|
@ -56,6 +56,10 @@ public class BrokerView implements BrokerViewMBean {
|
|||
return broker;
|
||||
}
|
||||
|
||||
public void setBroker(ManagedRegionBroker broker) {
|
||||
this.broker = broker;
|
||||
}
|
||||
|
||||
public String getBrokerId() {
|
||||
return broker.getBrokerId().toString();
|
||||
}
|
||||
|
|
|
@ -217,6 +217,10 @@ public class ManagementContext implements Service {
|
|||
return findTigerMbeanServer;
|
||||
}
|
||||
|
||||
public boolean isConnectorStarted() {
|
||||
return connectorServer.isActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables/disables the searching for the Java 5 platform MBeanServer
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue