Skip to content
Snippets Groups Projects
Commit 5b9169e7 authored by Nelson Tavares de Sousa's avatar Nelson Tavares de Sousa
Browse files

removed bug that didn't let the analysis terminate

parent 619ab59d
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,7 @@ abstract class AbstractRunnableStage implements Runnable { ...@@ -46,6 +46,7 @@ abstract class AbstractRunnableStage implements Runnable {
} while (!stage.shouldBeTerminated()); } while (!stage.shouldBeTerminated());
} catch (StageException e) { } catch (StageException e) {
this.stage.terminate(); this.stage.terminate();
failed = true;
} }
afterStageExecution(stage); afterStageExecution(stage);
...@@ -66,6 +67,7 @@ abstract class AbstractRunnableStage implements Runnable { ...@@ -66,6 +67,7 @@ abstract class AbstractRunnableStage implements Runnable {
stage.onSignal(signal, inputPorts[i]); stage.onSignal(signal, inputPorts[i]);
} }
} }
System.out.println("HELLO");
throw new IllegalStateException("Terminated by StageExceptionListener"); throw new IllegalStateException("Terminated by StageExceptionListener");
} }
......
...@@ -22,6 +22,7 @@ import static org.junit.Assert.assertThat; ...@@ -22,6 +22,7 @@ import static org.junit.Assert.assertThat;
import org.junit.Test; import org.junit.Test;
import teetime.framework.Analysis; import teetime.framework.Analysis;
import teetime.framework.AnalysisException;
import teetime.framework.StageState; import teetime.framework.StageState;
public class ExceptionHandlingTest { public class ExceptionHandlingTest {
...@@ -34,14 +35,12 @@ public class ExceptionHandlingTest { ...@@ -34,14 +35,12 @@ public class ExceptionHandlingTest {
return configuration; return configuration;
} }
@Test
public void exceptionPassingAndTermination() { public void exceptionPassingAndTermination() {
newInstances(); newInstances();
analysis.executeBlocking(); analysis.executeBlocking();
assertEquals(TestListener.exceptionInvoked, 2); // listener did not kill thread to early assertEquals(TestListener.exceptionInvoked, 2); // listener did not kill thread too early
} }
@Test
public void terminatesAllStages() { public void terminatesAllStages() {
ExceptionTestConfiguration config = newInstances(); ExceptionTestConfiguration config = newInstances();
analysis.executeBlocking(); analysis.executeBlocking();
...@@ -53,8 +52,12 @@ public class ExceptionHandlingTest { ...@@ -53,8 +52,12 @@ public class ExceptionHandlingTest {
@Test @Test
public void forAFewTimes() { public void forAFewTimes() {
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
newInstances(); try {
exceptionPassingAndTermination(); exceptionPassingAndTermination();
terminatesAllStages();
} catch (AnalysisException e) {
// Correct behavior
}
} }
} }
} }
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