String deploymentName = getDeploymentName();
if (deploymentName == null) {
throw new IllegalStateException("Deployment " + getDeploymentKey() + " has vanished");
}
DeploymentProgress progress = deploymentManager.stop(deploymentName);
DeploymentStatus stopStatus = DeploymentUtils.run(progress);
if (stopStatus.isFailed()) {
LOG.error("Failed to stop deployment '" + deploymentName + "'.", stopStatus.getFailure());
throw new Exception("Failed to stop deployment '" + deploymentName + "' - cause: "
+ stopStatus.getFailure());