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

true kill the thread from now on; Added implementations for different

listeners
parent ca0b2e97
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ abstract class RunnableStage implements Runnable { ...@@ -30,7 +30,7 @@ abstract class RunnableStage implements Runnable {
try { try {
executeStage(); executeStage();
} catch (StageException e) { } catch (StageException e) {
if (!this.listener.onStageException(e, e.getThrowingStage())) { if (this.listener.onStageException(e, e.getThrowingStage())) {
this.stage.terminate(); this.stage.terminate();
} }
} }
......
...@@ -6,11 +6,10 @@ public class IgnoringStageListener extends StageExceptionListener { ...@@ -6,11 +6,10 @@ public class IgnoringStageListener extends StageExceptionListener {
public IgnoringStageListener() { public IgnoringStageListener() {
super(); super();
// TODO Auto-generated constructor stub
} }
@Override @Override
public boolean onStageException(final Exception e, final Stage throwingStage) { public boolean onStageException(final Exception e, final Stage throwingStage) {
return true; return false;
} }
} }
package teetime.framework.exceptionHandling;
import teetime.framework.Stage;
public class LoggingStageListener extends StageExceptionListener {
@Override
public boolean onStageException(final Exception e, final Stage throwingStage) {
logger.warn("Exception arised from" + throwingStage.getId(), e);
return false;
}
}
...@@ -28,7 +28,7 @@ public abstract class StageExceptionListener { ...@@ -28,7 +28,7 @@ public abstract class StageExceptionListener {
* @param throwingStage * @param throwingStage
* the stage, which has thrown the exception. * the stage, which has thrown the exception.
* @return * @return
* true, if the thread can continue with execution or false, if thread should be terminated * true, if the thread should be terminated, false otherwise
*/ */
public abstract boolean onStageException(Exception e, Stage throwingStage); public abstract boolean onStageException(Exception e, Stage throwingStage);
......
package teetime.framework.exceptionHandling;
import teetime.framework.Stage;
public class TerminatingStageListener extends StageExceptionListener {
@Override
public boolean onStageException(final Exception e, final Stage throwingStage) {
logger.warn("Exception arised from" + throwingStage.getId(), e);
return true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment