final ServiceName replacedDeploymentUnitServiceName = Services.deploymentUnitName(replacedDeploymentUnitName);
final ServiceName replacedContentsServiceName = replacedDeploymentUnitServiceName.append("contents");
operationContext.removeService(replacedContentsServiceName);
operationContext.removeService(replacedDeploymentUnitServiceName);
ServiceVerificationHandler verificationHandler = new ServiceVerificationHandler();
final Collection<ServiceController<?>> controllers = doDeploy(context, deploymentUnitName, managementName, verificationHandler, deployment, registration, mutableRegistration, contents);
context.addStep(verificationHandler, OperationContext.Stage.VERIFY);
if (context.completeStep() == OperationContext.ResultAction.ROLLBACK) {
for(ServiceController<?> controller : controllers) {
context.removeService(controller.getName());
}
DeploymentModelUtils.cleanup(deployment);
final String name = originalDeployment.require(NAME).asString();
final String runtimeName = originalDeployment.require(RUNTIME_NAME).asString();
final DeploymentHandlerUtil.ContentItem[] contents = getContents(originalDeployment.require(CONTENT));
verificationHandler = new ServiceVerificationHandler();
doDeploy(context, runtimeName, name, verificationHandler, deployment, registration, mutableRegistration, contents);
if (context.hasFailureDescription()) {
ServerLogger.ROOT_LOGGER.replaceRolledBack(replacedDeploymentUnitName, deploymentUnitName, context.getFailureDescription().asString());
} else {