From 3d0adbbc29ee50515967d78924923092115a1921 Mon Sep 17 00:00:00 2001
From: Christian Wulf <chw@informatik.uni-kiel.de>
Date: Fri, 13 Feb 2015 10:13:49 +0100
Subject: [PATCH] removed WaitStrategy temporarily due to bad implementation

---
 run-configurations/mvn-install.launch         | 16 ++++
 .../teetime/framework/idle/WaitStrategy.java  | 36 ---------
 .../java/teetime/framework/pipe/SpScPipe.java |  9 ---
 .../framework/RunnableConsumerStageTest.java  | 77 +++++++++----------
 .../framework/WaitStrategyConfiguration.java  |  3 +-
 5 files changed, 55 insertions(+), 86 deletions(-)
 create mode 100644 run-configurations/mvn-install.launch
 delete mode 100644 src/main/java/teetime/framework/idle/WaitStrategy.java

diff --git a/run-configurations/mvn-install.launch b/run-configurations/mvn-install.launch
new file mode 100644
index 00000000..380c361b
--- /dev/null
+++ b/run-configurations/mvn-install.launch
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
+<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
+<stringAttribute key="M2_GOALS" value="install"/>
+<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
+<booleanAttribute key="M2_OFFLINE" value="false"/>
+<stringAttribute key="M2_PROFILES" value=""/>
+<listAttribute key="M2_PROPERTIES"/>
+<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
+<booleanAttribute key="M2_SKIP_TESTS" value="true"/>
+<intAttribute key="M2_THREADS" value="1"/>
+<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
+<stringAttribute key="M2_USER_SETTINGS" value=""/>
+<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="I:/Repositories/teetime"/>
+</launchConfiguration>
diff --git a/src/main/java/teetime/framework/idle/WaitStrategy.java b/src/main/java/teetime/framework/idle/WaitStrategy.java
deleted file mode 100644
index b00d6bad..00000000
--- a/src/main/java/teetime/framework/idle/WaitStrategy.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Copyright (C) 2015 TeeTime (http://teetime.sourceforge.net)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package teetime.framework.idle;
-
-import teetime.framework.Stage;
-
-public final class WaitStrategy implements IdleStrategy {
-
-	private final Stage stage;
-
-	public WaitStrategy(final Stage stage) {
-		super();
-		this.stage = stage;
-	}
-
-	@Override
-	public void execute() throws InterruptedException {
-		synchronized (stage) {
-			stage.wait();
-		}
-	}
-
-}
diff --git a/src/main/java/teetime/framework/pipe/SpScPipe.java b/src/main/java/teetime/framework/pipe/SpScPipe.java
index 41360556..947a5fb7 100644
--- a/src/main/java/teetime/framework/pipe/SpScPipe.java
+++ b/src/main/java/teetime/framework/pipe/SpScPipe.java
@@ -53,15 +53,6 @@ public final class SpScPipe extends AbstractInterThreadPipe {
 			this.numWaits++;
 			Thread.yield();
 		}
-
-		Thread owningThread = cachedTargetStage.getOwningThread();
-		if (null != owningThread && isThreadWaiting(owningThread)) { // FIXME remove the null check for performance
-			synchronized (cachedTargetStage) {
-				cachedTargetStage.notify();
-				// LOGGER.trace("Notified: " + cachedTargetStage);
-			}
-		}
-
 		return true;
 	}
 
diff --git a/src/test/java/teetime/framework/RunnableConsumerStageTest.java b/src/test/java/teetime/framework/RunnableConsumerStageTest.java
index b28342f2..cb9d2e28 100644
--- a/src/test/java/teetime/framework/RunnableConsumerStageTest.java
+++ b/src/test/java/teetime/framework/RunnableConsumerStageTest.java
@@ -17,7 +17,6 @@ package teetime.framework;
 
 import static org.junit.Assert.assertEquals;
 
-import java.lang.Thread.State;
 import java.util.Collection;
 
 import org.junit.Test;
@@ -28,44 +27,44 @@ import com.google.common.base.Joiner;
 
 public class RunnableConsumerStageTest {
 
-	@Test
-	public void testWaitingInfinitely() throws Exception {
-		WaitStrategyConfiguration waitStrategyConfiguration = new WaitStrategyConfiguration(300, 42);
-
-		final Analysis analysis = new Analysis(waitStrategyConfiguration);
-		Thread thread = new Thread(new Runnable() {
-			@Override
-			public void run() {
-				start(analysis); // FIXME react on exceptions
-			}
-		});
-		thread.start();
-
-		Thread.sleep(200);
-
-		assertEquals(State.WAITING, thread.getState());
-		assertEquals(0, waitStrategyConfiguration.getCollectorSink().getElements().size());
-	}
-
-	@Test
-	public void testWaitingFinitely() throws Exception {
-		WaitStrategyConfiguration waitStrategyConfiguration = new WaitStrategyConfiguration(300, 42);
-
-		final Analysis analysis = new Analysis(waitStrategyConfiguration);
-		Thread thread = new Thread(new Runnable() {
-			@Override
-			public void run() {
-				start(analysis); // FIXME react on exceptions
-			}
-		});
-		thread.start();
-
-		Thread.sleep(400);
-
-		assertEquals(State.TERMINATED, thread.getState());
-		assertEquals(42, waitStrategyConfiguration.getCollectorSink().getElements().get(0));
-		assertEquals(1, waitStrategyConfiguration.getCollectorSink().getElements().size());
-	}
+	// @Test
+	// public void testWaitingInfinitely() throws Exception {
+	// WaitStrategyConfiguration waitStrategyConfiguration = new WaitStrategyConfiguration(300, 42);
+	//
+	// final Analysis analysis = new Analysis(waitStrategyConfiguration);
+	// Thread thread = new Thread(new Runnable() {
+	// @Override
+	// public void run() {
+	// start(analysis); // FIXME react on exceptions
+	// }
+	// });
+	// thread.start();
+	//
+	// Thread.sleep(200);
+	//
+	// assertEquals(State.WAITING, thread.getState());
+	// assertEquals(0, waitStrategyConfiguration.getCollectorSink().getElements().size());
+	// }
+	//
+	// @Test
+	// public void testWaitingFinitely() throws Exception {
+	// WaitStrategyConfiguration waitStrategyConfiguration = new WaitStrategyConfiguration(300, 42);
+	//
+	// final Analysis analysis = new Analysis(waitStrategyConfiguration);
+	// Thread thread = new Thread(new Runnable() {
+	// @Override
+	// public void run() {
+	// start(analysis); // FIXME react on exceptions
+	// }
+	// });
+	// thread.start();
+	//
+	// Thread.sleep(400);
+	//
+	// assertEquals(State.TERMINATED, thread.getState());
+	// assertEquals(42, waitStrategyConfiguration.getCollectorSink().getElements().get(0));
+	// assertEquals(1, waitStrategyConfiguration.getCollectorSink().getElements().size());
+	// }
 
 	@Test
 	public void testYieldRun() throws Exception {
diff --git a/src/test/java/teetime/framework/WaitStrategyConfiguration.java b/src/test/java/teetime/framework/WaitStrategyConfiguration.java
index f0fff053..3c491ac3 100644
--- a/src/test/java/teetime/framework/WaitStrategyConfiguration.java
+++ b/src/test/java/teetime/framework/WaitStrategyConfiguration.java
@@ -15,7 +15,6 @@
  */
 package teetime.framework;
 
-import teetime.framework.idle.WaitStrategy;
 import teetime.framework.pipe.IPipeFactory;
 import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering;
 import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
@@ -69,7 +68,7 @@ class WaitStrategyConfiguration extends AnalysisConfiguration {
 		Relay<Object> relay = new Relay<Object>();
 		CollectorSink<Object> collectorSink = new CollectorSink<Object>();
 
-		relay.setIdleStrategy(new WaitStrategy(relay));
+		// relay.setIdleStrategy(new WaitStrategy(relay));
 
 		interThreadPipeFactory.create(delay.getOutputPort(), relay.getInputPort());
 		intraThreadPipeFactory.create(relay.getOutputPort(), collectorSink.getInputPort());
-- 
GitLab