OESE-38 Only one instance of JMX server at a time (Guice injection error)

master
David BRASSELY 2014-06-10 09:58:05 +02:00
parent 1f320b81be
commit 940c416587
2 changed files with 15 additions and 5 deletions

View File

@ -136,6 +136,7 @@ public class Bootstrap {
throws Exception {
String errMsg = null;
JMXConnector jmxConn = null;
try {
Map env = new HashMap();
String[] creds = {"admin", "admin"};
@ -144,18 +145,23 @@ public class Bootstrap {
JMXServiceURL serviceURL = new JMXServiceURL(
String.format(DEFAULT_SERVICE_URL, DEFAULT_INSTANCE_PORT));
JMXConnector jmxConn = JMXConnectorFactory.connect(serviceURL, env);
jmxConn = JMXConnectorFactory.connect(serviceURL, env);
MBeanServerConnection mbsConn = jmxConn.getMBeanServerConnection();
ObjectName fwMBeanName = new ObjectName("net.open-esb.standalone",
"instance", DEFAULT_INSTANCE_NAME);
mbsConn.invoke(fwMBeanName, "stop", new Object[0], new String[0]);
/*
} catch (NumberFormatException nfEx) {
mLog.log(Level.SEVERE, "Invalid JMX connector port value. {0}", nfEx.getMessage());
mLog.log(Level.SEVERE, "Invalid JMX connector port value. {0}", nfEx.getMessage());*/
} catch (javax.management.MBeanException mbEx) {
errMsg = mbEx.getTargetException().toString();
} catch (Throwable t) {
errMsg = t.toString();
} finally {
if (jmxConn != null) {
jmxConn.close();
}
}
if (errMsg != null) {

View File

@ -43,6 +43,8 @@ public class InstanceNode implements Node {
private final Environment environment;
private JMXService jMXService;
public InstanceNode () {
if(LOG.isLoggable(Level.INFO)) {
LOG.log(Level.INFO, I18NBundle.getBundle().getMessage(
@ -82,7 +84,9 @@ public class InstanceNode implements Node {
long startTime = System.currentTimeMillis(); // Get the start Time
injector.getInstance(JMXService.class).start();
jMXService = injector.getInstance(JMXService.class);
jMXService.start();
injector.getInstance(FrameworkService.class).start();
injector.getInstance(HttpServer.class).start();
@ -129,7 +133,7 @@ public class InstanceNode implements Node {
injector.getInstance(HttpServer.class).stop();
injector.getInstance(FrameworkService.class).stop();
injector.getInstance(JMXService.class).stop();
jMXService.stop();
if(LOG.isLoggable(Level.INFO)) {
LOG.log(Level.INFO, I18NBundle.getBundle().getMessage(