- slcProcess.setStatus(SlcExecution.STATUS_RUNNING);
- executionModulesManager.dispatchUpdateStatus(slcProcess,
- SlcExecution.STATUS_SCHEDULED, SlcExecution.STATUS_RUNNING);
+ process.setStatus(SlcExecution.RUNNING);
+ executionModulesManager.dispatchUpdateStatus(process,
+ SlcExecution.SCHEDULED, SlcExecution.RUNNING);
+
+ process();
+
+ // waits for all execution threads to complete (in case they were
+ // started asynchronously)
+ for (ExecutionThread executionThread : executionThreads) {
+ if (executionThread.isAlive()) {
+ try {
+ executionThread.join();
+ } catch (InterruptedException e) {
+ log.error("Execution thread " + executionThread
+ + " was interrupted");
+ }
+ }
+ }
+
+ // TODO: error management at flow level?
+ if (hadAnError)
+ process.setStatus(SlcExecution.ERROR);
+ else
+ process.setStatus(SlcExecution.COMPLETED);
+ executionModulesManager.dispatchUpdateStatus(process,
+ SlcExecution.RUNNING, process.getStatus());
+
+ log.info("\n## SLC Process #" + process.getUuid() + " COMPLETED\n");
+ }