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

Added InitializingSignal and adopted the framework

parent 983d6546
No related branches found
No related tags found
No related merge requests found
......@@ -154,9 +154,10 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
throw new IllegalStateException("Unhandled termination strategy: " + terminationStrategy);
}
final Set<Stage> intraStages = traverseIntraStages(stage);
final AbstractExceptionListener newListener = factory.createInstance();
initializeIntraStages(intraStages, thread, newListener);
// FIXME: remove, if this solves the #151 bug
// final Set<Stage> intraStages = traverseIntraStages(stage);
// final AbstractExceptionListener newListener = factory.createInstance();
// initializeIntraStages(intraStages, thread, newListener);
}
}
......
......@@ -15,6 +15,7 @@
*/
package teetime.framework;
import teetime.framework.signal.InitializingSignal;
import teetime.framework.signal.StartingSignal;
import teetime.framework.signal.TerminatingSignal;
......@@ -26,6 +27,8 @@ public final class RunnableProducerStage extends AbstractRunnableStage {
@Override
protected void beforeStageExecution(final Stage stage) {
InitializingSignal initializingSignal = new InitializingSignal();
stage.onSignal(initializingSignal, null);
final StartingSignal startingSignal = new StartingSignal();
stage.onSignal(startingSignal, null);
}
......
/**
* Copyright (C) 2015 Christian Wulf, Nelson Tavares de Sousa (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.signal;
import java.util.LinkedList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import teetime.framework.Stage;
public final class InitializingSignal implements ISignal {
private static final Logger LOGGER = LoggerFactory.getLogger(StartingSignal.class);
private final List<Exception> catchedExceptions = new LinkedList<Exception>();
public InitializingSignal() {}
@Override
public void trigger(final Stage stage) {
try {
stage.onInitializing();
} catch (Exception e) { // NOCS (Stages can throw any arbitrary Exception)
this.catchedExceptions.add(e);
LOGGER.error("Exception while sending the start signal", e);
}
}
public List<Exception> getCatchedExceptions() {
return this.catchedExceptions;
}
}
wiki @ bb53dfd7
Subproject commit 0e4474577e1f49bc96e734c286b2d9e0363895e8
Subproject commit bb53dfd7de974a433a7b96b0b65f4aacb8da3df3
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