@Override public Result execute(DeploymentExecutionContext context) throws Exception { Result executionResult = Result.Success; configureLockCleaner(context, cisToBeLocked); for (ConfigurationItem each : cisToBeLocked) { String targetType = (each instanceof Environment) ? "Environment " : "Container "; if (LockFileHelper.isLocked(each)) { context.logError( targetType + each.getName() + " is locked. A different deployment may already be in progress."); executionResult = Result.Fail; } context.logOutput( targetType + each.getName() + " is available, locking it for this deployment."); LockFileHelper.lock(each); } return executionResult; }