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();
|
processHelperProperties();
|
||||||
|
if (isUseJmx()) {
|
||||||
|
startManagementContext();
|
||||||
|
}
|
||||||
getPersistenceAdapter().setUsageManager(getProducerSystemUsage());
|
getPersistenceAdapter().setUsageManager(getProducerSystemUsage());
|
||||||
getPersistenceAdapter().setBrokerName(getBrokerName());
|
getPersistenceAdapter().setBrokerName(getBrokerName());
|
||||||
LOG.info("Using Persistence Adapter: " + getPersistenceAdapter());
|
LOG.info("Using Persistence Adapter: " + getPersistenceAdapter());
|
||||||
|
@ -451,12 +454,15 @@ public class BrokerService implements Service {
|
||||||
addShutdownHook();
|
addShutdownHook();
|
||||||
getBroker().start();
|
getBroker().start();
|
||||||
if (isUseJmx()) {
|
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;
|
ManagedRegionBroker managedBroker = (ManagedRegionBroker) regionBroker;
|
||||||
managedBroker.setContextBroker(broker);
|
managedBroker.setContextBroker(broker);
|
||||||
adminView = new BrokerView(this, managedBroker);
|
adminView.setBroker(managedBroker);
|
||||||
ObjectName objectName = getBrokerObjectName();
|
|
||||||
AnnotatedMBean.registerMBean(getManagementContext(), adminView, objectName);
|
|
||||||
}
|
}
|
||||||
BrokerRegistry.getInstance().bind(getBrokerName(), this);
|
BrokerRegistry.getInstance().bind(getBrokerName(), this);
|
||||||
// see if there is a MasterBroker service and if so, configure
|
// see if there is a MasterBroker service and if so, configure
|
||||||
|
@ -1895,6 +1901,13 @@ public class BrokerService implements Service {
|
||||||
protected void slaveConnectionEstablished() {
|
protected void slaveConnectionEstablished() {
|
||||||
slaveStartSignal.countDown();
|
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
|
* Start all transport and network connections, proxies and bridges
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.activemq.network.NetworkConnector;
|
||||||
*/
|
*/
|
||||||
public class BrokerView implements BrokerViewMBean {
|
public class BrokerView implements BrokerViewMBean {
|
||||||
|
|
||||||
final ManagedRegionBroker broker;
|
ManagedRegionBroker broker;
|
||||||
private final BrokerService brokerService;
|
private final BrokerService brokerService;
|
||||||
private final AtomicInteger sessionIdCounter = new AtomicInteger(0);
|
private final AtomicInteger sessionIdCounter = new AtomicInteger(0);
|
||||||
|
|
||||||
|
@ -56,6 +56,10 @@ public class BrokerView implements BrokerViewMBean {
|
||||||
return broker;
|
return broker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBroker(ManagedRegionBroker broker) {
|
||||||
|
this.broker = broker;
|
||||||
|
}
|
||||||
|
|
||||||
public String getBrokerId() {
|
public String getBrokerId() {
|
||||||
return broker.getBrokerId().toString();
|
return broker.getBrokerId().toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,11 @@ public class ManagementContext implements Service {
|
||||||
return findTigerMbeanServer;
|
return findTigerMbeanServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public boolean isConnectorStarted() {
|
||||||
|
return connectorServer.isActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Enables/disables the searching for the Java 5 platform MBeanServer
|
* Enables/disables the searching for the Java 5 platform MBeanServer
|
||||||
*/
|
*/
|
||||||
public void setFindTigerMbeanServer(boolean findTigerMbeanServer) {
|
public void setFindTigerMbeanServer(boolean findTigerMbeanServer) {
|
||||||
|
|
Loading…
Reference in New Issue