in jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java [448:491]
protected void unregisterComponent(ComponentImpl component) {
if (component != null) {
try {
component.stop(false);
component.shutDown(false, true);
// TODO: Undeploy SAs and put their bundles in the pending state
// Undeploy SAs
Set<ServiceAssemblyImpl> sas = new HashSet<ServiceAssemblyImpl>();
for (ServiceUnit su : component.getServiceUnits()) {
sas.add((ServiceAssemblyImpl) su.getServiceAssembly());
}
for (ServiceAssemblyImpl sa : sas) {
Bundle bundle = sa.getBundle();
ServiceAssemblyInstaller installer = (ServiceAssemblyInstaller) installers.get(bundle);
if (installer != null) {
try {
installer.stop(true);
pendingAssemblies.remove(sa);
if (installer.getDeployedAssembly() == null) {
unregisterServiceAssembly(sa);
pendingInstallers.add(installer);
} else {
installers.remove(bundle);
}
} catch (Exception e) {
logger.warn("Error uninstalling service assembly", e);
}
}
}
unregisterServices(component.getBundle());
} catch (JBIException e) {
logger.warn("Error when shutting down component", e);
}
for (SharedLibrary lib : component.getSharedLibraries()) {
((SharedLibraryImpl) lib).removeComponent(component);
}
components.remove(component.getName());
try {
getEnvironment().unmanageObject(component);
} catch (Exception e) {
logger.error("Error unmanage component: {}", component.getName(), e);
}
}
}