in core/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java [618:671]
public void init() throws JBIException {
if (containerInitialized.compareAndSet(false, true)) {
LOGGER.info("ServiceMix {} JBI Container ({}) is starting", EnvironmentContext.getVersion(), getName());
LOGGER.info("For help or more information please see: http://servicemix.apache.org/");
addShutdownHook();
if (this.executorFactory == null) {
this.executorFactory = createExecutorFactory();
}
if (this.namingContext == null) {
try {
this.namingContext = new InitialContext();
} catch (NamingException e) {
// Log a warning, with exception only in debug
if (LOGGER.isDebugEnabled()) {
LOGGER.warn("Failed to set InitialContext", e);
} else {
LOGGER.warn("Failed to set InitialContext");
}
}
}
managementContext.init(this, getMBeanServer());
mbeanServer = this.managementContext.getMBeanServer(); // just in case ManagementContext creates it
environmentContext.init(this, getRootDir());
clientFactory.init(this);
if (services != null) {
for (int i = 0; i < services.length; i++) {
services[i].init(this);
}
}
registry.init(this);
broker.init(this);
installationService.init(this);
deploymentService.init(this);
autoDeployService.init(this);
adminCommandsService.init(this);
// register self with the ManagementContext
try {
managementContext.registerMBean(ManagementContext.getContainerObjectName(managementContext.getJmxDomainName(), getName()),
this, LifeCycleMBean.class);
} catch (JMException e) {
throw new JBIException(e);
}
// Initialize listeners after the whole container has been initialized
// so that they can register themselves as JMX mbeans for example
if (configuredListeners != null) {
for (int i = 0; i < configuredListeners.length; i++) {
EventListener listener = configuredListeners[i];
addListener(listener);
}
}
}
}