if (connectionInfo == null)
return;
// Create an RMI registry
if (connectionInfo.getRmiServerPort() == 0)
throw new EngineException("Connection.Properties", "No RMI port specified for service registry.");
// Create an RMI registry
int rmiServerPort = connectionInfo.getRmiServerPort();
LogUtil.info(getClass(), "Binding to RMI registry using binding name $0, port {1}.", CoreConstants.RMI_BINDING_NAME, new Integer(rmiServerPort));
Registry registry = null;
try
{
// This fails, if OpenBP has already been started & stopped in the same VM instance before.
registry = LocateRegistry.createRegistry(rmiServerPort);
}
catch (RemoteException e)
{
if (e instanceof java.rmi.server.ExportException)
{
// registry probably already exists
registry = LocateRegistry.getRegistry(rmiServerPort);
}
else
throw e;
}
// Bind the service to the RMI registry
registry.rebind(CoreConstants.RMI_BINDING_NAME, this);
}
catch (RemoteException e)
{
String msg = LogUtil.error(getClass(), "Error binding remote interface.", e);
String bindingErrorHandler = SettingUtil.getStringSetting(ServerConstants.SYSPROP_RMIBINDINGERRORHANDLING);
if ("ignore".equals(bindingErrorHandler))
{
}
else if ("output".equals(bindingErrorHandler))
{
LogUtil.error(getClass(), msg);
}
else
{
throw new EngineException("Initialization", msg, e);
}
}
}