]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java
Ignore files
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / ExecutionThread.java
index 71e2100e29e078e15c7e421d4e0f211ef2c9e33c..9289c7f56f03acd98c8b3921775aa850a474fa88 100644 (file)
@@ -31,12 +31,10 @@ import org.springframework.security.context.SecurityContextHolder;
 /** Thread of a single execution */
 public class ExecutionThread extends Thread {
        public final static String SYSPROP_EXECUTION_AUTO_UPGRADE = "slc.execution.autoupgrade";
-
        private final static Log log = LogFactory.getLog(ExecutionThread.class);
 
        private ExecutionModulesManager executionModulesManager;
        private final RealizedFlow realizedFlow;
-       // private final ProcessThread processThread;
 
        private List<Runnable> destructionCallbacks = new ArrayList<Runnable>();
 
@@ -47,7 +45,6 @@ public class ExecutionThread extends Thread {
                                + realizedFlow.getFlowDescriptor().getName());
                this.realizedFlow = realizedFlow;
                this.executionModulesManager = executionModulesManager;
-               // this.processThread = processThread;
        }
 
        public void run() {
@@ -73,10 +70,19 @@ public class ExecutionThread extends Thread {
                        if (autoUpgrade != null && autoUpgrade.equals("true"))
                                executionModulesManager.upgrade(realizedFlow
                                                .getModuleNameVersion());
-
+                       executionModulesManager.start(realizedFlow.getModuleNameVersion());
+                       //
                        // START FLOW
+                       //
                        executionModulesManager.execute(realizedFlow);
                        // END FLOW
+               } catch (FlowConfigurationException e) {
+                       String msg = "Configuration problem with flow " + flowName + ":\n"
+                                       + e.getMessage();
+                       log.error(msg);
+                       getProcessThreadGroup().dispatchAddStep(
+                                       new ExecutionStep(realizedFlow.getModuleName(),
+                                                       ExecutionStep.ERROR, msg + " " + e.getMessage()));
                } catch (Exception e) {
                        // TODO: re-throw exception ?
                        String msg = "Execution of flow " + flowName + " failed.";
@@ -84,9 +90,7 @@ public class ExecutionThread extends Thread {
                        getProcessThreadGroup().dispatchAddStep(
                                        new ExecutionStep(realizedFlow.getModuleName(),
                                                        ExecutionStep.ERROR, msg + " " + e.getMessage()));
-                       // processThread.notifyError();
                } finally {
-                       // processThread.flowCompleted();
                        getProcessThreadGroup().dispatchAddStep(
                                        new ExecutionStep(realizedFlow.getModuleName(),
                                                        ExecutionStep.PHASE_END, "Flow " + flowName));
@@ -94,10 +98,6 @@ public class ExecutionThread extends Thread {
                }
        }
 
-       // private void dispatchAddStep(ExecutionStep step) {
-       // getProcessThreadGroup().dispatchAddStep(step);
-       // }
-
        private synchronized void processDestructionCallbacks() {
                for (int i = destructionCallbacks.size() - 1; i >= 0; i--) {
                        try {
@@ -119,11 +119,5 @@ public class ExecutionThread extends Thread {
 
        protected ProcessThreadGroup getProcessThreadGroup() {
                return (ProcessThreadGroup) getThreadGroup();
-               // return processThread.getProcessThreadGroup();
        }
-
-       // public RealizedFlow getRealizedFlow() {
-       // return realizedFlow;
-       // }
-
-}
+}
\ No newline at end of file