@Override
public void stop(Deployment dep) {
if (stopServices) {
final DeploymentUnit unit = getRequiredAttachment(dep, DeploymentUnit.class);
for (final Endpoint ep : dep.getService().getEndpoints()) {
LifecycleHandler lifecycleHandler = getLifecycleHandler(ep, false);
if (lifecycleHandler != null)
lifecycleHandler.stop(ep);
EndpointService.uninstall(ep, unit);
}
} else {
super.stop(dep);
}