]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java
Document and improve execution model
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / ExecutionThread.java
index d8c7289894db3f353487b62a92ff0a8405fcb39a..52040fd50707a5e604b38ddf86f392d95ae0cb31 100644 (file)
@@ -51,7 +51,7 @@ public class ExecutionThread extends Thread {
                                .getFlowDescriptor();
                String flowName = executionFlowDescriptor.getName();
 
-               dispatchAddStep(new SlcExecutionStep(SlcExecutionStep.TYPE_PHASE_START,
+               dispatchAddStep(new SlcExecutionStep(SlcExecutionStep.PHASE_START,
                                "Flow " + flowName));
 
                try {
@@ -60,17 +60,21 @@ public class ExecutionThread extends Thread {
                        if (autoUpgrade != null && autoUpgrade.equals("true"))
                                processThread.getExecutionModulesManager().upgrade(
                                                realizedFlow.getModuleNameVersion());
+
+                       // START FLOW
                        processThread.getExecutionModulesManager().execute(realizedFlow);
+                       // END FLOW
                } catch (Exception e) {
                        // TODO: re-throw exception ?
                        String msg = "Execution of flow " + flowName + " failed.";
                        log.error(msg, e);
-                       dispatchAddStep(new SlcExecutionStep(msg + " " + e.getMessage()));
+                       dispatchAddStep(new SlcExecutionStep(SlcExecutionStep.ERROR, msg
+                                       + " " + e.getMessage()));
                        processThread.notifyError();
                } finally {
                        processThread.flowCompleted();
-                       dispatchAddStep(new SlcExecutionStep(
-                                       SlcExecutionStep.TYPE_PHASE_END, "Flow " + flowName));
+                       dispatchAddStep(new SlcExecutionStep(SlcExecutionStep.PHASE_END,
+                                       "Flow " + flowName));
                }
        }