in core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/MBeanServerContext.java [113:143]
public void stop() throws IOException {
if (started.compareAndSet(true, false)) {
if (connectorServerFactoryBean != null) {
try {
connectorServerFactoryBean.destroy();
} catch (Exception e) {
LOGGER.warn("Failed to stop jmx connector: {}", e.getMessage());
LOGGER.debug("Failed to stop jmx connector", e);
} finally {
connectorServerFactoryBean = null;
}
}
if (rmiRegistryFactoryBean != null) {
try {
rmiRegistryFactoryBean.destroy();
} catch (RemoteException e) {
LOGGER.warn("Failed to stop rmi registry: {}", e.getMessage());
LOGGER.debug("Failed to stop rmi registry", e);
} finally {
rmiRegistryFactoryBean = null;
}
}
if (locallyCreateMBeanServer && beanServer != null) {
// check to see if the factory knows about this server
List list = MBeanServerFactory.findMBeanServer(null);
if (list != null && !list.isEmpty() && list.contains(beanServer)) {
MBeanServerFactory.releaseMBeanServer(beanServer);
}
}
}
}