From b0b1513bc5ccf17e9a9ec68b411f3eb345bbea38 Mon Sep 17 00:00:00 2001
From: Christian Wulf <chw@informatik.uni-kiel.de>
Date: Wed, 18 Jun 2014 07:43:27 +0200
Subject: [PATCH] added RunnableStage

---
 .../MethodCallThroughputAnalysis16.java       | 26 ++-----------------
 .../throughput/methodcall/RunnableStage.java  | 20 ++++++++++++++
 2 files changed, 22 insertions(+), 24 deletions(-)
 create mode 100644 src/test/java/teetime/examples/throughput/methodcall/RunnableStage.java

diff --git a/src/test/java/teetime/examples/throughput/methodcall/MethodCallThroughputAnalysis16.java b/src/test/java/teetime/examples/throughput/methodcall/MethodCallThroughputAnalysis16.java
index 02a812a7..d9cade7b 100644
--- a/src/test/java/teetime/examples/throughput/methodcall/MethodCallThroughputAnalysis16.java
+++ b/src/test/java/teetime/examples/throughput/methodcall/MethodCallThroughputAnalysis16.java
@@ -88,18 +88,7 @@ public class MethodCallThroughputAnalysis16 extends Analysis {
 
 		UnorderedGrowablePipe.connect(objectProducer.getOutputPort(), this.distributor.getInputPort());
 
-		final Runnable runnable = new Runnable() {
-			@Override
-			public void run() {
-				pipeline.onStart();
-				do {
-					pipeline.executeWithPorts();
-				} while (pipeline.isReschedulable());
-				// System.out.println("buildProducerPipeline finished");
-			}
-		};
-
-		return runnable;
+		return new RunnableStage(pipeline);
 	}
 
 	/**
@@ -136,18 +125,7 @@ public class MethodCallThroughputAnalysis16 extends Analysis {
 		UnorderedGrowablePipe.connect(noopFilters[noopFilters.length - 1].getOutputPort(), stopTimestampFilter.getInputPort());
 		UnorderedGrowablePipe.connect(stopTimestampFilter.getOutputPort(), collectorSink.getInputPort());
 
-		final Runnable runnable = new Runnable() {
-			@Override
-			public void run() {
-				pipeline.onStart();
-				do {
-					pipeline.executeWithPorts();
-				} while (pipeline.isReschedulable());
-				// System.out.println("buildPipeline finished");
-			}
-		};
-
-		return runnable;
+		return new RunnableStage(pipeline);
 	}
 
 	@Override
diff --git a/src/test/java/teetime/examples/throughput/methodcall/RunnableStage.java b/src/test/java/teetime/examples/throughput/methodcall/RunnableStage.java
new file mode 100644
index 00000000..57107f5a
--- /dev/null
+++ b/src/test/java/teetime/examples/throughput/methodcall/RunnableStage.java
@@ -0,0 +1,20 @@
+package teetime.examples.throughput.methodcall;
+
+public class RunnableStage implements Runnable {
+
+	private final StageWithPort<?, ?> stage;
+
+	public RunnableStage(final StageWithPort<?, ?> stage) {
+		this.stage = stage;
+	}
+
+	@Override
+	public void run() {
+		this.stage.onStart();
+
+		do {
+			this.stage.executeWithPorts();
+		} while (this.stage.isReschedulable());
+	}
+
+}
-- 
GitLab