2 * Copyright (C) 2007-2012 Argeo GmbH
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org
.argeo
.slc
.core
.execution
;
18 import java
.util
.concurrent
.ArrayBlockingQueue
;
19 import java
.util
.concurrent
.BlockingQueue
;
21 import org
.argeo
.slc
.execution
.ExecutionProcess
;
22 import org
.argeo
.slc
.execution
.ExecutionStep
;
23 import org
.springframework
.security
.Authentication
;
24 import org
.springframework
.security
.context
.SecurityContextHolder
;
26 /** The thread group attached to a given {@link SlcExecution}. */
27 public class ProcessThreadGroup
extends ThreadGroup
{
28 // private final ExecutionModulesManager executionModulesManager;
29 // private final ProcessThread processThread;
30 private final Authentication authentication
;
31 private final static Integer STEPS_BUFFER_CAPACITY
= 5000;
33 private BlockingQueue
<ExecutionStep
> steps
= new ArrayBlockingQueue
<ExecutionStep
>(
34 STEPS_BUFFER_CAPACITY
);
36 private Boolean hadAnError
= false;
38 public ProcessThreadGroup(ExecutionProcess executionProcess
) {
39 super("SLC Process #" + executionProcess
.getUuid() + " thread group");
40 // this.executionModulesManager = executionModulesManager;
41 // this.processThread = processThread;
42 this.authentication
= SecurityContextHolder
.getContext()
46 public Authentication
getAuthentication() {
47 return authentication
;
50 public void dispatchAddStep(ExecutionStep step
) {
51 // ExecutionProcess slcProcess = processThread.getProcess();
52 // List<ExecutionStep> steps = new ArrayList<ExecutionStep>();
54 // TODO clarify why we don't dispatch steps, must be a reason
55 // dispatchAddSteps(steps);
56 // slcProcess.addSteps(steps);
57 if (step
.getType().equals(ExecutionStep
.ERROR
))
62 // public void dispatchAddSteps(List<ExecutionStep> steps) {
63 // ExecutionProcess slcProcess = processThread.getProcess();
64 // executionModulesManager.dispatchAddSteps(slcProcess, steps);
67 public BlockingQueue
<ExecutionStep
> getSteps() {
71 public Boolean
hadAnError() {