From 3207ffc16e7112ee9a080ff65056f121734baef1 Mon Sep 17 00:00:00 2001
From: Christian Wulf <chw@informatik.uni-kiel.de>
Date: Mon, 30 Jun 2014 10:53:25 +0200
Subject: [PATCH] added Thread.yield() to Relay

---
 .../java/teetime/variant/methodcallWithPorts/stage/Relay.java  | 1 +
 .../ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest.java  | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/Relay.java b/src/main/java/teetime/variant/methodcallWithPorts/stage/Relay.java
index cec12ca5..b0a6325c 100644
--- a/src/main/java/teetime/variant/methodcallWithPorts/stage/Relay.java
+++ b/src/main/java/teetime/variant/methodcallWithPorts/stage/Relay.java
@@ -18,6 +18,7 @@ public class Relay<T> extends AbstractStage<T, T> {
 				this.logger.debug("got end signal; pipe.size: " + this.getInputPort().getPipe().size());
 				assert 0 == this.getInputPort().getPipe().size();
 			}
+			Thread.yield();
 			return;
 		}
 		this.send(element);
diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest.java b/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest.java
index 544c0b5e..2353d523 100644
--- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest.java
+++ b/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest.java
@@ -22,7 +22,9 @@ import java.util.concurrent.TimeUnit;
 
 import org.junit.After;
 import org.junit.Before;
+import org.junit.FixMethodOrder;
 import org.junit.Test;
+import org.junit.runners.MethodSorters;
 
 import teetime.util.StatisticsUtil;
 import teetime.util.StopWatch;
@@ -32,6 +34,7 @@ import teetime.util.StopWatch;
  * 
  * @since 1.10
  */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest {
 
 	private StopWatch stopWatch;
-- 
GitLab