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

moved related classes to own package; first prototype

parent 1ee20c7e
No related branches found
No related tags found
No related merge requests found
package teetime.framework;
import teetime.framework.exceptionHandling.StageException;
import teetime.framework.idle.IdleStrategy;
import teetime.framework.idle.YieldStrategy;
......@@ -20,7 +21,11 @@ public abstract class AbstractConsumerStage<I> extends AbstractStage {
returnNoElement();
}
this.execute(element);
try {
this.execute(element);
} catch (Exception e) {
throw new StageException(e, this);
}
}
protected abstract void execute(I element);
......
package teetime.framework;
import teetime.framework.exceptionHandling.StageException;
/**
* The <code>ProducerStage</code> produces at least one element at each execution.<br>
*
......@@ -19,7 +21,11 @@ public abstract class AbstractProducerStage<O> extends AbstractStage {
@Override
public void executeWithPorts() {
this.execute();
try {
this.execute();
} catch (Exception e) {
throw new StageException(e, this);
}
}
@Override
......
......@@ -3,6 +3,8 @@ package teetime.framework;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import teetime.framework.exceptionHandling.StageException;
abstract class RunnableStage implements Runnable {
protected final Stage stage;
......@@ -22,7 +24,11 @@ abstract class RunnableStage implements Runnable {
beforeStageExecution();
do {
executeStage();
try {
executeStage();
} catch (StageException e) {
// TODO: handle exception
}
} while (!this.stage.shouldBeTerminated());
afterStageExecution();
......
package teetime.framework;
package teetime.framework.exceptionHandling;
import teetime.framework.Stage;
/**
* Represents an Exception, which is thrown by stages, if uncatched exceptions are thrown.
*
*/
public class StageException extends Exception {
public class StageException extends RuntimeException {
/**
* Generated UID
......
package teetime.framework;
package teetime.framework.exceptionHandling;
import teetime.framework.Stage;
/**
* Represent a minimalistic StageExceptionListener. Listener which extend from this one, must a least implement this functionality.
......
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