Skip to content
Snippets Groups Projects
Commit c06ded45 authored by Christian Wulf's avatar Christian Wulf
Browse files

fixed concurrency bugs

parent 0f7ac177
No related branches found
No related tags found
No related merge requests found
package teetime.framework; package teetime.framework;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
...@@ -23,12 +24,12 @@ class ThreadService extends AbstractService<ThreadService> { ...@@ -23,12 +24,12 @@ class ThreadService extends AbstractService<ThreadService> {
private static final Logger LOGGER = LoggerFactory.getLogger(ThreadService.class); private static final Logger LOGGER = LoggerFactory.getLogger(ThreadService.class);
private final List<Thread> consumerThreads = new LinkedList<Thread>(); private final List<Thread> consumerThreads = Collections.synchronizedList(new LinkedList<Thread>());
private final List<Thread> finiteProducerThreads = new LinkedList<Thread>(); private final List<Thread> finiteProducerThreads = Collections.synchronizedList(new LinkedList<Thread>());
private final List<Thread> infiniteProducerThreads = new LinkedList<Thread>(); private final List<Thread> infiniteProducerThreads = Collections.synchronizedList(new LinkedList<Thread>());
private final SignalingCounter runnableCounter = new SignalingCounter(); private final SignalingCounter runnableCounter = new SignalingCounter();
private final Set<Stage> threadableStages = new HashSet<Stage>(); private final Set<Stage> threadableStages = Collections.synchronizedSet(new HashSet<Stage>());
private final Configuration configuration; private final Configuration configuration;
...@@ -77,17 +78,17 @@ class ThreadService extends AbstractService<ThreadService> { ...@@ -77,17 +78,17 @@ class ThreadService extends AbstractService<ThreadService> {
throw new IllegalStateException("No stage was added using the addThreadableStage(..) method. Add at least one stage."); throw new IllegalStateException("No stage was added using the addThreadableStage(..) method. Add at least one stage.");
} }
A2InvalidThreadAssignmentCheck checker = new A2InvalidThreadAssignmentCheck(threadableStages); A2InvalidThreadAssignmentCheck checker = new A2InvalidThreadAssignmentCheck(newThreadableStages);
checker.check(); checker.check();
A3PipeInstantiation pipeVisitor = new A3PipeInstantiation(); A3PipeInstantiation pipeVisitor = new A3PipeInstantiation();
traversor = new Traverser(pipeVisitor, Direction.BOTH); traversor = new Traverser(pipeVisitor, Direction.BOTH);
traversor.traverse(startStage); traversor.traverse(startStage);
A4StageAttributeSetter attributeSetter = new A4StageAttributeSetter(configuration, threadableStages); A4StageAttributeSetter attributeSetter = new A4StageAttributeSetter(configuration, newThreadableStages);
attributeSetter.setAttributes(); attributeSetter.setAttributes();
for (Stage stage : threadableStages) { for (Stage stage : newThreadableStages) {
categorizeThreadableStage(stage); categorizeThreadableStage(stage);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment