private void loadObjects() { long startLoad = System.nanoTime(); Log.i("ObjectManager", "Loading objects from ObjectDatabase..."); System.out.println("ObjectManager: Loading objects from ObjectDatabase..."); database.load(); database.traverse( new Traverser<SWGObject>() { @Override public void process(SWGObject obj) { loadObject(obj); if (obj.getObjectId() >= maxObjectId) { maxObjectId = obj.getObjectId() + 1; } } }); double loadTime = (System.nanoTime() - startLoad) / 1E6; Log.i("ObjectManager", "Finished loading %d objects. Time: %fms", database.size(), loadTime); System.out.printf( "ObjectManager: Finished loading %d objects. Time: %fms%n", database.size(), loadTime); }
@Override public boolean terminate() { database.traverse((obj) -> obj.setOwner(null)); database.close(); return super.terminate(); }