[Fix] initialize MfsSohExecutionPolicy earlier, and catch exceptions
This commit is contained in:
parent
14b27ca3f2
commit
207bcf0711
|
@ -72,11 +72,17 @@ public class ExecuteActivityCommand extends BasePlanningAndExecutionCommand
|
||||||
|
|
||||||
ConfirmationPolicy confirmationPolicy = getConfirmationPolicy(action);
|
ConfirmationPolicy confirmationPolicy = getConfirmationPolicy(action);
|
||||||
ExecutionPolicy executionPolicy = getExecutionPolicy(action);
|
ExecutionPolicy executionPolicy = getExecutionPolicy(action);
|
||||||
|
|
||||||
|
// 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()) {
|
if (executionPolicy.isStopped()) {
|
||||||
this.controller.removeExecutionPolicy(action);
|
this.controller.removeExecutionPolicy(action);
|
||||||
executionPolicy = getExecutionPolicy(action);
|
executionPolicy = getExecutionPolicy(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
executionPolicy.initialize(action);
|
||||||
if (!executionPolicy.isExecutable(action)) {
|
if (!executionPolicy.isExecutable(action)) {
|
||||||
logger.info("Action " + action.getLocator() + " is not yet executable.");
|
logger.info("Action " + action.getLocator() + " is not yet executable.");
|
||||||
return;
|
return;
|
||||||
|
@ -84,10 +90,6 @@ public class ExecuteActivityCommand extends BasePlanningAndExecutionCommand
|
||||||
|
|
||||||
logger.info("Action " + action.getLocator() + " is now being executed...");
|
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 {
|
|
||||||
executionPolicy.initialize(action);
|
|
||||||
executionPolicy.toExecution(action);
|
executionPolicy.toExecution(action);
|
||||||
confirmationPolicy.toExecution(action);
|
confirmationPolicy.toExecution(action);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue