URI amqConfigUri = baseDir.resolve(amqConfigFile);
ClassLoader old = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
try {
BrokerFactoryBean brokerFactory = new BrokerFactoryBean(
new FileSystemResource(new File(amqConfigUri)));
//TODO There should be a better way to avoid the concurrent broker creations
synchronized (BrokerServiceGBeanImpl.class) {
System.setProperty("activemq.brokerName", brokerName);
System.setProperty("activemq.home", new File(baseDir).toString());
System.setProperty("activemq.data", new File(dataDir).toString());
File geronimoHomeURL = serverInfo.resolveServer("./");
System.setProperty("activemq.geronimo.home.url", geronimoHomeURL.toURI().toURL().toString());
brokerFactory.afterPropertiesSet();
}
brokerService = brokerFactory.getBroker();
// brokerService = BrokerFactory.createBroker(new URI(brokerUri));
// Do not allow creation of another ConnectorServer
ManagementContext mgmtctx = new ManagementContext(mbeanServerReference != null ? mbeanServerReference.getMBeanServer() : null);
mgmtctx.setCreateConnector(false);