}
} else {
bootTimeScanner = null;
}
context.addStep(new OperationStepHandler() {
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException {
final List<ServiceController<?>> controllers = new ArrayList<ServiceController<?>>();
final ServiceVerificationHandler verificationHandler = new ServiceVerificationHandler();
performRuntime(context, operation, model, verificationHandler, controllers, scheduledExecutorService, bootTimeScanner);
context.addStep(verificationHandler, OperationContext.Stage.VERIFY);
context.completeStep(new OperationContext.RollbackHandler() {
@Override
public void handleRollback(OperationContext context, ModelNode operation) {
rollbackRuntime(context, operation, model, controllers);
}
});
}
}, OperationContext.Stage.RUNTIME);
if (bootTimeScan) {
final AtomicReference<ModelNode> deploymentOperation = new AtomicReference<ModelNode>();
final AtomicReference<ModelNode> deploymentResults = new AtomicReference<ModelNode>(new ModelNode());
final CountDownLatch scanDoneLatch = new CountDownLatch(1);
final CountDownLatch deploymentDoneLatch = new CountDownLatch(1);
final DeploymentOperations deploymentOps = new BootTimeScannerDeployment(deploymentOperation, deploymentDoneLatch, deploymentResults, scanDoneLatch);
scheduledExecutorService.submit(new Runnable() {
@Override
public void run() {
try {
bootTimeScanner.oneOffScan(deploymentOps);
} catch (Throwable t){
DeploymentScannerLogger.ROOT_LOGGER.initialScanFailed(t);
} finally {
scanDoneLatch.countDown();
}
}
});
boolean interrupted = false;
boolean asyncCountDown = false;
try {
scanDoneLatch.await();
final ModelNode op = deploymentOperation.get();
if (op != null) {
final ModelNode result = new ModelNode();
final PathAddress opPath = PathAddress.pathAddress(op.get(OP_ADDR));
final OperationStepHandler handler = context.getRootResourceRegistration().getOperationHandler(opPath, op.get(OP).asString());
context.addStep(result, op, handler, OperationContext.Stage.MODEL);
stepCompleted = true;
context.completeStep(new OperationContext.ResultHandler() {
@Override