]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.core/src/org/argeo/slc/core/execution/ProcessThreadGroup.java
Make HttpContext configurable
[gpl/argeo-slc.git] / org.argeo.slc.core / src / org / argeo / slc / core / execution / ProcessThreadGroup.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.slc.core.execution;
17
18 import java.util.concurrent.ArrayBlockingQueue;
19 import java.util.concurrent.BlockingQueue;
20
21 import org.argeo.slc.execution.ExecutionProcess;
22 import org.argeo.slc.execution.ExecutionStep;
23
24 /** The thread group attached to a given {@link SlcExecution}. */
25 public class ProcessThreadGroup extends ThreadGroup {
26 // private final Authentication authentication;
27 private final static Integer STEPS_BUFFER_CAPACITY = 5000;
28
29 private BlockingQueue<ExecutionStep> steps = new ArrayBlockingQueue<ExecutionStep>(
30 STEPS_BUFFER_CAPACITY);
31
32 private Boolean hadAnError = false;
33
34 public ProcessThreadGroup(ExecutionProcess executionProcess) {
35 super("SLC Process #" + executionProcess.getUuid() + " thread group");
36 // this.authentication = SecurityContextHolder.getContext()
37 // .getAuthentication();
38 }
39
40 // public Authentication getAuthentication() {
41 // return authentication;
42 // }
43
44 public void dispatchAddStep(ExecutionStep step) {
45 // ExecutionProcess slcProcess = processThread.getProcess();
46 // List<ExecutionStep> steps = new ArrayList<ExecutionStep>();
47 // steps.add(step);
48 // TODO clarify why we don't dispatch steps, must be a reason
49 // dispatchAddSteps(steps);
50 // slcProcess.addSteps(steps);
51 if (step.getType().equals(ExecutionStep.ERROR))
52 hadAnError = true;
53 this.steps.add(step);
54 }
55
56 // public void dispatchAddSteps(List<ExecutionStep> steps) {
57 // ExecutionProcess slcProcess = processThread.getProcess();
58 // executionModulesManager.dispatchAddSteps(slcProcess, steps);
59 // }
60
61 public BlockingQueue<ExecutionStep> getSteps() {
62 return steps;
63 }
64
65 public Boolean hadAnError() {
66 return hadAnError;
67 }
68 }