Я пытался переопределить метод AnyLogic writeObject в
моей функции основного агента, чтобы найти последнего сериализующего агента.
Код: Выделить всё
try {
FileOutputStream fos = new FileOutputStream("t.tmp");
ObjectOutputStream out = new ObjectOutputStream(fos) {
@Override
protected void writeObjectOverride(Object obj) {
System.out.println("Serializing: " + obj.getClass().getName() + " - " + obj);
super.writeObjectOverride(obj);
}
};
out.writeObject(this);
out.close();
System.out.println("Serialization completed successfully");
} catch (IOException e) {
System.err.println("Serialization error: " + e.getMessage());
e.printStackTrace();
}
Что случилось?
Подробнее здесь: https://stackoverflow.com/questions/797 ... n-anylogic
Мобильная версия