diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/RunnableStage.java b/src/main/java/teetime/variant/methodcallWithPorts/framework/core/RunnableStage.java index c7435b030199b7a3ccfc03106c294780f1fa2412..9d4961c5f40dc5c1164f8ceede7b3d2e032ebf44 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/RunnableStage.java +++ b/src/main/java/teetime/variant/methodcallWithPorts/framework/core/RunnableStage.java @@ -1,20 +1,30 @@ package teetime.variant.methodcallWithPorts.framework.core; +import kieker.common.logging.Log; +import kieker.common.logging.LogFactory; + public class RunnableStage implements Runnable { private final StageWithPort<?, ?> stage; + private final Log logger; public RunnableStage(final StageWithPort<?, ?> stage) { this.stage = stage; + this.logger = LogFactory.getLog(stage.getClass()); } @Override public void run() { - this.stage.onStart(); + try { + this.stage.onStart(); - do { - this.stage.executeWithPorts(); - } while (this.stage.isReschedulable()); + do { + this.stage.executeWithPorts(); + } while (this.stage.isReschedulable()); + } catch (RuntimeException e) { + this.logger.error("Terminating thread due to the following exception: ", e); + throw e; + } } } diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/EndStage.java b/src/main/java/teetime/variant/methodcallWithPorts/stage/EndStage.java index a9d5dddb23f2aa1aae307f756fefaefbade5b933..41e4f9e83e75178efb9d820fedd474db450dd461 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/EndStage.java +++ b/src/main/java/teetime/variant/methodcallWithPorts/stage/EndStage.java @@ -58,7 +58,7 @@ public class EndStage<T> implements StageWithPort<T, T> { @Override public void executeWithPorts() { - // this.getInputPort().receive(); // just consume + this.getInputPort().receive(); // just consume // do nothing // this.count++; // Object r = this.closure.execute(null); diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/TCPReader.java b/src/main/java/teetime/variant/methodcallWithPorts/stage/io/TCPReader.java index 091bff10d6dc368a68cafa183ca9a210b357fea2..a5d73561aaa78a21e85d6b34f2d732b34d35bead 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/TCPReader.java +++ b/src/main/java/teetime/variant/methodcallWithPorts/stage/io/TCPReader.java @@ -28,6 +28,7 @@ import teetime.variant.methodcallWithPorts.framework.core.ProducerStage; import kieker.common.exception.MonitoringRecordException; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; +import kieker.common.record.AbstractMonitoringRecord; import kieker.common.record.IMonitoringRecord; import kieker.common.record.flow.trace.TraceMetadata; import kieker.common.record.flow.trace.operation.AfterOperationEvent; @@ -150,8 +151,8 @@ public class TCPReader extends ProducerStage<Void, IMonitoringRecord> { final long loggingTimestamp = buffer.getLong(); final IMonitoringRecord record; try { // NOCS (Nested try-catch) - record = this.recordFactory.create(clazzid, buffer, this.stringRegistry); - // record = AbstractMonitoringRecord.createFromByteBuffer(clazzid, buffer, this.stringRegistry); + // record = this.recordFactory.create(clazzid, buffer, this.stringRegistry); + record = AbstractMonitoringRecord.createFromByteBuffer(clazzid, buffer, this.stringRegistry); record.setLoggingTimestamp(loggingTimestamp); this.send(record); } catch (final MonitoringRecordException ex) {