]> git.argeo.org Git - gpl/argeo-slc.git/blob - ProcessThreadGroup.java
79f38d77b48c686480d32b9695ba578be5771eba
[gpl/argeo-slc.git] / ProcessThreadGroup.java
1 package org.argeo.slc.runtime;
2
3 import java.util.concurrent.ArrayBlockingQueue;
4 import java.util.concurrent.BlockingQueue;
5
6 import org.argeo.slc.execution.ExecutionProcess;
7 import org.argeo.slc.execution.ExecutionStep;
8
9 /** The thread group attached to a given {@link SlcExecution}. */
10 public class ProcessThreadGroup extends ThreadGroup {
11 // private final Authentication authentication;
12 private final static Integer STEPS_BUFFER_CAPACITY = 5000;
13
14 private BlockingQueue<ExecutionStep> steps = new ArrayBlockingQueue<ExecutionStep>(
15 STEPS_BUFFER_CAPACITY);
16
17 private Boolean hadAnError = false;
18
19 public ProcessThreadGroup(ExecutionProcess executionProcess) {
20 super("SLC Process #" + executionProcess.getUuid() + " thread group");
21 // this.authentication = SecurityContextHolder.getContext()
22 // .getAuthentication();
23 }
24
25 // public Authentication getAuthentication() {
26 // return authentication;
27 // }
28
29 public void dispatchAddStep(ExecutionStep step) {
30 // ExecutionProcess slcProcess = processThread.getProcess();
31 // List<ExecutionStep> steps = new ArrayList<ExecutionStep>();
32 // steps.add(step);
33 // TODO clarify why we don't dispatch steps, must be a reason
34 // dispatchAddSteps(steps);
35 // slcProcess.addSteps(steps);
36 if (step.getType().equals(ExecutionStep.ERROR))
37 hadAnError = true;
38 this.steps.add(step);
39 }
40
41 // public void dispatchAddSteps(List<ExecutionStep> steps) {
42 // ExecutionProcess slcProcess = processThread.getProcess();
43 // executionModulesManager.dispatchAddSteps(slcProcess, steps);
44 // }
45
46 public BlockingQueue<ExecutionStep> getSteps() {
47 return steps;
48 }
49
50 public Boolean hadAnError() {
51 return hadAnError;
52 }
53 }