AFAIU, VMs are special hosts, surf_exit try to free them before GC
kicks in. After many tries, decide to rename finalize as destroy and
call this method explicitly as before.
Msg.info("Let's shut down the simulation and kill everyone.");
for (int i = 0; i < vms.size(); i++) {
- vms.get(i).shutdown();
- vms.get(i).finalize();
+ vms.get(i).destroy();
}
Msg.info("Master done.");
}
Main.setEndOfTest();
Msg.info("Forcefully destroy VMs");
for (VM vm: vms)
- vm.finalize();
+ vm.destroy();
}
}
Msg.info("Wait another 5 seconds. The tasks stop at some point in between");
waitFor(5);
- vmHost1.shutdown();
- vmHost3.shutdown();
- vmHost1.finalize();
- vmHost3.finalize();
+ vmHost1.destroy();
+ vmHost3.destroy();
}
}
}
return null;
}
- @Override
- public void finalize() {
+
+ public void destroy() {
try {
nativeFinalize();
- } catch (Throwable e) {
+ } catch (Exception e) {
e.printStackTrace();
}
}