git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@745833 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2009-02-19 12:09:21 +00:00
parent 8b0bb3373a
commit 76d9fccb2d
1 changed files with 5 additions and 2 deletions

View File

@ -55,7 +55,7 @@ public class ManagementContext implements Service {
private boolean createMBeanServer = true; private boolean createMBeanServer = true;
private boolean locallyCreateMBeanServer; private boolean locallyCreateMBeanServer;
private boolean createConnector = true; private boolean createConnector = true;
private boolean findTigerMbeanServer; private boolean findTigerMbeanServer = true;
private int connectorPort = 1099; private int connectorPort = 1099;
private int rmiServerPort; private int rmiServerPort;
private String connectorPath = "/jmxrmi"; private String connectorPath = "/jmxrmi";
@ -297,7 +297,7 @@ public class ManagementContext implements Service {
return result; return result;
} }
public static MBeanServer findTigerMBeanServer() { public MBeanServer findTigerMBeanServer() {
String name = "java.lang.management.ManagementFactory"; String name = "java.lang.management.ManagementFactory";
Class type = loadClass(name, ManagementContext.class.getClassLoader()); Class type = loadClass(name, ManagementContext.class.getClassLoader());
if (type != null) { if (type != null) {
@ -306,6 +306,9 @@ public class ManagementContext implements Service {
if (method != null) { if (method != null) {
Object answer = method.invoke(null, new Object[0]); Object answer = method.invoke(null, new Object[0]);
if (answer instanceof MBeanServer) { if (answer instanceof MBeanServer) {
if (createConnector) {
createConnector((MBeanServer)answer);
}
return (MBeanServer)answer; return (MBeanServer)answer;
} else { } else {
LOG.warn("Could not cast: " + answer + " into an MBeanServer. There must be some classloader strangeness in town"); LOG.warn("Could not cast: " + answer + " into an MBeanServer. There must be some classloader strangeness in town");