[Fix] initialize MfsSohExecutionPolicy earlier, and catch exceptions

This commit is contained in:
Robert von Burg 2020-06-08 22:11:09 +02:00
parent 14b27ca3f2
commit 207bcf0711
1 changed files with 13 additions and 11 deletions

View File

@ -72,22 +72,24 @@ public class ExecuteActivityCommand extends BasePlanningAndExecutionCommand
ConfirmationPolicy confirmationPolicy = getConfirmationPolicy(action);
ExecutionPolicy executionPolicy = getExecutionPolicy(action);
if (executionPolicy.isStopped()) {
this.controller.removeExecutionPolicy(action);
executionPolicy = getExecutionPolicy(action);
}
if (!executionPolicy.isExecutable(action)) {
logger.info("Action " + action.getLocator() + " is not yet executable.");
return;
}
logger.info("Action " + action.getLocator() + " is now being executed...");
// we catch all exceptions because we can't undo, thus need to set the state to ERROR in this case
// this is only required because we execute actions in same TX as we set to executed any previous actions
try {
if (executionPolicy.isStopped()) {
this.controller.removeExecutionPolicy(action);
executionPolicy = getExecutionPolicy(action);
}
executionPolicy.initialize(action);
if (!executionPolicy.isExecutable(action)) {
logger.info("Action " + action.getLocator() + " is not yet executable.");
return;
}
logger.info("Action " + action.getLocator() + " is now being executed...");
executionPolicy.toExecution(action);
confirmationPolicy.toExecution(action);