Commit 986d066b authored by Julian Zobel's avatar Julian Zobel
Browse files

Output fix for simulator

parent be5718ff
......@@ -218,11 +218,12 @@ public class DefaultMonitor implements MonitorComponent, EventHandler,
String wl = ExperimentDAO.getExperimentWorkload();
if(wl != null) {
output.write("-- Workload -- \n");
output.write(wl + " \n");
output.write("---- \n");
output.write(wl);
}
output.close();
//output.close();
} catch (IOException e) {
throw new AssertionError();
}
......@@ -239,7 +240,7 @@ public class DefaultMonitor implements MonitorComponent, EventHandler,
}
try {
output.write(Time.getFormattedTime() + ": [DefaultMonitor] started, initialized all analyzers.. \n");
output.write("[DefaultMonitor] started, initialized all analyzers.. \n");
} catch (IOException e) {
throw new AssertionError();
}
......@@ -248,7 +249,7 @@ public class DefaultMonitor implements MonitorComponent, EventHandler,
} else if (type == MONITOR_TEST) {
//
} else if (type == MONITOR_STOP) {
this.close();
// this.close();
} else {
throw new AssertionError("Unknown event type.");
}
......
......@@ -252,18 +252,21 @@ public class Simulator implements RandomGeneratorComponent, GlobalComponent {
this.running = false;
if (finishedWithoutError) {
Monitor.log(Simulator.class, Level.INFO,
"Simulation successfully finished :)");
"Simulation successfully finished :)");
System.out.println("Simulation successfully finished");
} else {
if(reason == null) {
Monitor.log(Simulator.class, Level.ERROR,
"Simulation finished with unresolved errors ???");
System.out.println("Simulation finished with unresolved errors ???");
}
else {
Monitor.log(Simulator.class, Level.ERROR,
"Simulation finished with errors :( \n " +
reason.toString() + " : " + reason.getStackTrace());
}
System.out.println("Simulation finished with errors :( \n " +
reason.toString() + " : " + reason.getStackTrace());
}
}
long runTime = System.currentTimeMillis() - startTime;
long minutes = (long) Math.floor((runTime) / 60000);
......@@ -288,8 +291,12 @@ public class Simulator implements RandomGeneratorComponent, GlobalComponent {
for (SimulatorObserver so : observers) {
so.simulationFinished();
}
ExperimentDAO.simulationFinished(finishedWithoutError);
// FIXME Hack?
// closing the monitor before also closes the stream and makes it impossible to track erros on simulation termination
DefaultMonitor.getInstance().close();
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment