示例#1
0
  @Override
  public void initialize(Cache cache) {
    int count = 0;
    try {
      Container container =
          Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
      ReferenceTable table = ReferenceTable.decode(container.getData());

      Entry entry = table.getEntry(ConfigArchive.OBJECT);
      Archive archive =
          Archive.decode(
              cache.read(CacheIndex.CONFIGS, ConfigArchive.OBJECT).getData(), entry.size());

      objs = new ObjectType[entry.capacity()];
      for (int id = 0; id < entry.capacity(); id++) {
        ChildEntry child = entry.getEntry(id);
        if (child == null) continue;

        ByteBuffer buffer = archive.getEntry(child.index());
        ObjectType type = new ObjectType(id);
        type.decode(buffer);
        objs[id] = type;
        count++;
      }
    } catch (IOException e) {
      logger.log(Level.SEVERE, "Error Loading ObjectType(s)!", e);
    }
    logger.info("Loaded " + count + " ObjectType(s)!");
  }