simulationJob
This commit is contained in:
parent
e41342f0ce
commit
980b0531d0
@ -133,12 +133,7 @@ public abstract class Simulation<U extends SimulationUser, M extends Simulation
|
||||
try {
|
||||
this.mainLogicRunning.set(true);
|
||||
this.systemTime = this.systemTime.plusNanos(timeAdd);
|
||||
this.jobMap.values().forEach(simulationJob -> {
|
||||
if (getSystemTime().compareTo(simulationJob.runtime) >= 0) {
|
||||
simulationJob.job.run();
|
||||
simulationJob.afterRun();
|
||||
}
|
||||
});
|
||||
this.jobMap.values().forEach(SimulationJob::run);
|
||||
} catch (Throwable e) {
|
||||
this.runError(e);
|
||||
log.error(String.format("仿真[%s]主线程逻辑执行异常,仿真停止运行", this.id), e);
|
||||
|
@ -28,5 +28,12 @@ public abstract class SimulationJob {
|
||||
this.runtime = runtime;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
if (simulation.getSystemTime().compareTo(runtime) >= 0) {
|
||||
this.job.run();
|
||||
this.afterRun();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void afterRun();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user