in jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ServiceAssemblyInstaller.java [105:132]
public void stop(boolean force) throws Exception {
ServiceAssemblyImpl assembly = deployer.getServiceAssembly(getName());
if (assembly == null && !force) {
throw ManagementSupport.failure("undeployServiceAssembly", "ServiceAssembly '" + getName() + "' is not deployed.");
}
// Check assembly state is shutdown
if (assembly != null && !LifeCycleMBean.SHUTDOWN.equals(assembly.getCurrentState())) {
if (!force) {
throw ManagementSupport.failure("undeployServiceAssembly", "ServiceAssembly '" + getName() + "' is not shut down.");
}
if (LifeCycleMBean.STARTED.equals(assembly.getCurrentState())) {
assembly.stop(false);
}
if (LifeCycleMBean.STOPPED.equals(assembly.getCurrentState())) {
assembly.shutDown(false, force);
}
}
if (deployedAssembly == null) {
if (assembly != null) {
for (ServiceUnitImpl su : assembly.getServiceUnitsList()) {
su.getComponentImpl().removeServiceUnit(su);
}
}
} else {
deployedAssembly.undeploy(bundle.getState() == Bundle.ACTIVE);
}
}