Made object manager stop initialization if serialization fails

This commit is contained in:
Obique PSWG
2016-05-16 20:08:14 -05:00
parent 068d51c441
commit 2d36855bf6
+6 -3
View File
@@ -104,19 +104,22 @@ public class ObjectManager extends Manager {
@Override
public boolean initialize() {
loadClientObjects();
loadObjects();
if (!loadObjects())
return false;
return super.initialize();
}
private void loadObjects() {
private boolean loadObjects() {
long startLoad = System.nanoTime();
Log.i("ObjectManager", "Loading objects from ObjectDatabase...");
synchronized (database) {
database.load();
if (!database.load())
return false;
database.traverse((obj) -> loadObject(obj));
}
double loadTime = (System.nanoTime() - startLoad) / 1E6;
Log.i("ObjectManager", "Finished loading %d objects. Time: %fms", database.size(), loadTime);
return true;
}
private void loadClientObjects() {