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

fixed bug which caused an interrupt upon correct termination

parent 433526e5
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@ abstract class AbstractRunnableStage implements Runnable {
executeStage();
}
} catch (TerminateException e) {
this.stage.terminate();
this.stage.abort();
stage.getOwningContext().abortConfigurationRun();
} finally {
afterStageExecution();
......
......@@ -254,9 +254,14 @@ public abstract class AbstractStage extends Stage {
@Override
protected void terminate() {
changeState(StageState.TERMINATING);
getOwningThread().interrupt();
}
@Override
protected void abort() {
this.terminate();
this.getOwningThread().interrupt();
};
@Override
protected boolean shouldBeTerminated() {
return (getCurrentState() == StageState.TERMINATING);
......
......@@ -134,6 +134,8 @@ public abstract class Stage {
protected abstract void terminate();
protected abstract void abort();
protected abstract boolean shouldBeTerminated();
public abstract StageState getCurrentState();
......
......@@ -149,7 +149,7 @@ class ThreadService extends AbstractService<ThreadService> {
private void abortStages(final Set<Stage> currentTreadableStages) {
synchronized (currentTreadableStages) {
for (Stage stage : currentTreadableStages) {
stage.terminate();
stage.abort();
}
}
}
......
......@@ -94,6 +94,9 @@ public class TerminationTest {
@Override
protected void terminate() {}
@Override
protected void abort() {}
}
private class Propagator extends AbstractConsumerStage<Integer> {
......
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