コード例 #1
0
ファイル: STRCommands.java プロジェクト: seba--/sugarj
  private static Path lookupAssimilationInCache(ModuleKeyCache<Path> strCache, ModuleKey key) {
    if (strCache == null) return null;

    Path result = null;

    log.beginTask("Searching", "Search assimilator in cache", Log.CACHING);
    try {
      result = strCache.get(key);

      if (result == null || !result.getFile().exists()) return null;

      log.log("Cache location: '" + result + "'", Log.CACHING);

      return result;
    } finally {
      log.endTask(result != null);
    }
  }
コード例 #2
0
ファイル: STRCommands.java プロジェクト: seba--/sugarj
  private static Path cacheAssimilator(
      ModuleKeyCache<Path> strCache, ModuleKey key, Path prog, Environment environment)
      throws IOException {
    if (strCache == null) return prog;

    log.beginTask("Caching", "Cache assimilator", Log.CACHING);
    try {
      Path cacheProg = environment.createCachePath(prog.getFile().getName());
      if (FileCommands.exists(prog)) FileCommands.copyFile(prog, cacheProg);
      else cacheProg = prog;

      Path oldProg = strCache.putGet(key, cacheProg);
      //      FileCommands.delete(oldProg);

      log.log("Cache Location: " + cacheProg, Log.CACHING);
      return cacheProg;
    } finally {
      log.endTask();
    }
  }