Skip to content
Snippets Groups Projects
Commit 8089e221 authored by Christian Wulf's avatar Christian Wulf
Browse files

adapted exceptional signal interface

parent 41e9bd59
No related branches found
No related tags found
No related merge requests found
#FindBugs User Preferences
#Wed Oct 22 13:18:41 CEST 2014
#Thu Oct 23 07:49:05 CEST 2014
detector_threshold=3
effort=max
excludefilter0=.fbExcludeFilterFile|true
......
......@@ -23,6 +23,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import teetime.framework.ProducerStage;
import teetime.framework.signal.OnStartingException;
import kieker.common.exception.MonitoringRecordException;
import kieker.common.record.AbstractMonitoringRecord;
......@@ -56,11 +57,11 @@ public class DbReader extends ProducerStage<IMonitoringRecord> {
private volatile boolean running = true;
@Override
public void onStarting() {
public void onStarting() throws OnStartingException {
try {
Class.forName(this.driverClassname).newInstance();
} catch (final Exception ex) { // NOPMD NOCS (IllegalCatchCheck)
throw new RuntimeException("DB driver registration failed. Perhaps the driver jar is missing?", ex);
throw new OnStartingException("DB driver registration failed. Perhaps the driver jar is missing?", ex);
}
}
......
......@@ -24,6 +24,7 @@ import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import teetime.framework.ProducerStage;
import teetime.framework.signal.OnStartingException;
import kieker.common.exception.MonitoringRecordException;
import kieker.common.logging.Log;
......@@ -76,13 +77,13 @@ public class TCPReader extends ProducerStage<IMonitoringRecord> {
}
@Override
public void onStarting() {
public void onStarting() throws OnStartingException {
super.onStarting();
this.recordFactory = new RecordFactory();
this.register();
this.tcpStringReader = new TCPStringReader(this.port2, this.stringRegistry);
this.tcpStringReader.start();
super.onStarting();
}
private void register() {
......
......@@ -27,6 +27,8 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import teetime.framework.ProducerStage;
import teetime.framework.signal.OnStartingException;
import teetime.framework.signal.OnTerminatingException;
import kieker.common.exception.MonitoringRecordException;
import kieker.common.logging.Log;
......@@ -78,7 +80,7 @@ public class TCPReaderSink extends ProducerStage<IMonitoringRecord> {
}
@Override
public void onStarting() {
public void onStarting() throws OnStartingException {
this.executorService.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
......@@ -149,8 +151,7 @@ public class TCPReaderSink extends ProducerStage<IMonitoringRecord> {
}
@Override
public void onTerminating() {
super.onTerminating();
public void onTerminating() throws OnTerminatingException {
this.executorService.shutdown();
this.tcpStringReader.interrupt();
super.onTerminating();
......
......@@ -21,6 +21,7 @@ import java.io.IOException;
import teetime.framework.ConsumerStage;
import teetime.framework.OutputPort;
import teetime.framework.signal.OnStartingException;
import teetime.stage.kieker.className.ClassNameRegistryRepository;
import kieker.common.exception.MonitoringRecordException;
......@@ -29,7 +30,7 @@ import kieker.common.util.filesystem.BinaryCompressionMethod;
/**
* @author Christian Wulf
*
*
* @since 1.10
*/
public class BinaryFile2RecordFilter extends ConsumerStage<File> {
......@@ -58,9 +59,9 @@ public class BinaryFile2RecordFilter extends ConsumerStage<File> {
}
@Override
public void onStarting() {
this.recordFromBinaryFileCreator = new RecordFromBinaryFileCreator(this.logger, this.classNameRegistryRepository);
public void onStarting() throws OnStartingException {
super.onStarting();
this.recordFromBinaryFileCreator = new RecordFromBinaryFileCreator(this.logger, this.classNameRegistryRepository);
}
public ClassNameRegistryRepository getClassNameRegistryRepository() {
......
......@@ -19,6 +19,7 @@ import java.util.concurrent.TimeUnit;
import teetime.framework.ConsumerStage;
import teetime.framework.OutputPort;
import teetime.framework.signal.OnTerminatingException;
import teetime.util.concurrent.hashmap.ConcurrentHashMapWithDefault;
import teetime.util.concurrent.hashmap.TraceBuffer;
......@@ -94,8 +95,7 @@ public class TraceReconstructionFilter extends ConsumerStage<IFlowRecord> {
}
@Override
public void onTerminating() {
super.onTerminating();
public void onTerminating() throws OnTerminatingException {
for (Long traceId : this.traceId2trace.keySet()) {
this.put(traceId, false);
}
......
......@@ -23,6 +23,7 @@ import java.util.Map.Entry;
import teetime.framework.ConsumerStage;
import teetime.framework.InputPort;
import teetime.framework.OutputPort;
import teetime.framework.signal.OnTerminatingException;
import kieker.analysis.plugin.filter.flow.TraceEventRecords;
......@@ -73,8 +74,7 @@ public class TraceReductionFilter extends ConsumerStage<TraceEventRecords> {
}
@Override
public void onTerminating() {
super.onTerminating();
public void onTerminating() throws OnTerminatingException {
synchronized (this.trace2buffer) { // BETTER hide and improve synchronization in the buffer
for (final Entry<TraceEventRecords, TraceAggregationBuffer> entry : this.trace2buffer.entrySet()) {
final TraceAggregationBuffer buffer = entry.getValue();
......
......@@ -20,12 +20,13 @@ import java.util.LinkedList;
import teetime.framework.ConsumerStage;
import teetime.framework.OutputPort;
import teetime.framework.signal.OnStartingException;
import teetime.stage.stringBuffer.handler.AbstractDataTypeHandler;
import teetime.stage.stringBuffer.util.KiekerHashMap;
/**
* @author Christian Wulf
*
*
* @since 1.10
*/
public class StringBufferFilter<T> extends ConsumerStage<T> {
......@@ -44,7 +45,7 @@ public class StringBufferFilter<T> extends ConsumerStage<T> {
}
@Override
public void onStarting() {
public void onStarting() throws OnStartingException {
for (final AbstractDataTypeHandler<?> handler : this.dataTypeHandlers) {
handler.setLogger(this.logger);
handler.setStringRepository(this.kiekerHashMap);
......
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