예제 #1
0
  public static synchronized RegionFile createOrLoadRegionFile(File par0File, int par1, int par2) {
    File file = new File(par0File, "region");
    File file1 =
        new File(
            file,
            (new StringBuilder())
                .append("r.")
                .append(par1 >> 5)
                .append(".")
                .append(par2 >> 5)
                .append(".mca")
                .toString());
    Reference reference = (Reference) regionsByFilename.get(file1);

    if (reference != null) {
      RegionFile regionfile = (RegionFile) reference.get();

      if (regionfile != null) {
        return regionfile;
      }
    }

    if (!file.exists()) {
      file.mkdirs();
    }

    if (regionsByFilename.size() >= 256) {
      clearRegionFileReferences();
    }

    RegionFile regionfile1 = new RegionFile(file1);
    regionsByFilename.put(file1, new SoftReference(regionfile1));
    return regionfile1;
  }
예제 #2
0
  /** Called to flush all changes to disk, waiting for them to complete. */
  public void flush() {
    try {
      ThreadedFileIOBase.threadedIOInstance.waitForFinish();
    } catch (InterruptedException var2) {
      var2.printStackTrace();
    }

    RegionFileCache.clearRegionFileReferences();
  }
 public void flushCache() {
   RegionFileCache.clearRegionFileReferences();
 }