if (_statePath == null || _inReplay) {
return;
}
List<TrainState> states = new ArrayList<TrainState>();
for (TrainInstance instance : _trainsById.values()) {
TrainState state = new TrainState();
state.setTrainId(instance.getTrainId());
state.setTrainUid(instance.getSchedule().getTrainUid());
state.setServiceDate(instance.getServiceDate());
state.setLastUpdateTimestamp(instance.getLastUpdateTime());
states.add(state);
}
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(
new FileOutputStream(_statePath)));