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

prepared DynamicActuator

parent 944c0c85
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@
*/
package teetime.framework;
import teetime.util.framework.concurrent.SignalingCounter;
public class DynamicActuator {
......@@ -30,10 +31,14 @@ public class DynamicActuator {
}
public Runnable startWithinNewThread(final Stage previousStage, final Stage stage) {
// SignalingCounter runtimeCounter = previousStage.owningContext.getThreadService().getRunnableCounter();
// SignalingCounter newCounter = stage.owningContext.getThreadService().getRunnableCounter();
SignalingCounter runtimeCounter = previousStage.owningContext.getThreadService().getRunnableCounter();
SignalingCounter newCounter = stage.owningContext.getThreadService().getRunnableCounter();
// runtimeCounter.inc(newCounter);
// stage.logger.error(stage.owningContext.getThreadService().getRunnableCounter().toString());
// !!! stage.owningContext = XXX.owningContext !!!
Runnable runnable = wrap(stage);
Thread thread = new Thread(runnable);
......@@ -42,6 +47,10 @@ public class DynamicActuator {
thread.start();
// requirements:
// 1. all new threads from stage must be known to the global context
// 2. number of active threads must be increased by the stage
if (runnable instanceof RunnableConsumerStage) {
// do nothing
} else if (runnable instanceof RunnableProducerStage) {
......
......@@ -65,4 +65,9 @@ public class SignalingCounter {
counter += otherCounter.counter;
conditionalNotifyAll(counter);
}
@Override
public String toString() {
return "counter: " + counter + ", " + super.toString();
}
}
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