return(mbeanServer);
}
private void startRMIRegistry() throws BrokerException {
String regPortStr = null;
Registry registry = null;
boolean registryExists = false;
int port;
if (!startRmiRegistry()) {
return;
}
port = getRmiRegistryPort();
String jmxHostname = Globals.getJMXHostname();
try {
if (jmxHostname != null && !jmxHostname.equals(Globals.HOSTNAME_ALL)) {
registry = LocateRegistry.getRegistry(jmxHostname, port);
} else {
registry = LocateRegistry.getRegistry(port);
}
/*
* Call list() to force a remote call - this
* confirms if the registry is up and running
*/
String s[] = registry.list();
registryExists = true;
} catch(RemoteException re) {
/*
* An exception will be caught if there is no registry running
* at the specified port. Not a problem since we are about
* to create a registry.
*/
}
if (registryExists) {
throw new BrokerException(rb.getString(rb.W_JMX_RMI_REGISTRY_EXISTS,
Integer.toString(port)));
}
try {
if (jmxHostname != null && !jmxHostname.equals(Globals.HOSTNAME_ALL)) {
MQRMIServerSocketFactory ssf =
new MQRMIServerSocketFactory(jmxHostname, 0, false);
registry = LocateRegistry.createRegistry(port, null, ssf);
} else {
registry = LocateRegistry.createRegistry(port);
}
/*
* Call list() to force a remote call - this
* confirms if the registry is up and running
*/
String s[] = registry.list();
logger.log(Logger.INFO,
rb.getString(rb.I_JMX_RMI_REGISTRY_STARTED, Integer.toString(port)));
} catch(RemoteException re) {
throw new BrokerException(
rb.getString(rb.W_JMX_RMI_REGISTRY_STARTED_EXCEPTION,