void () { long start = System.currentTimeMillis(); if (myOldModulesPaths != null) { LOG.info("Removing old compilation outputs " + myOldModulesPaths.size() + " counts"); myOldModulesPaths.forEach(file -> { if (file.exists()) FileUtil.delete(file); }); } if (myTmpFolderToModuleName == null) { LOG.debug("Nothing to apply, download results are empty"); return; } myContext.sendDescriptionStatusMessage(JpsBuildBundle.message("progress.text.applying.jps.caches")); ContainerUtil.map(myTmpFolderToModuleName.entrySet(), entry -> EXECUTOR_SERVICE.submit(() -> { String moduleName = entry.getValue(); File tmpModuleFolder = entry.getKey(); myContext.sendDescriptionStatusMessage(JpsBuildBundle.message("progress.details.applying.changes.for.module", moduleName)); File currentModuleBuildDir = new File(tmpModuleFolder.getParentFile(), moduleName); FileUtil.delete(currentModuleBuildDir); try { FileUtil.rename(tmpModuleFolder, currentModuleBuildDir); LOG.debug("Module: " + moduleName + " was replaced successfully"); } catch (IOException e) { LOG.warn("Couldn't replace compilation output for module: " + moduleName, e); } })) .forEach(future -> { try { future.get(); } catch (InterruptedException | ExecutionException e) { LOG.info("Couldn't apply compilation output", e); } }); LOG.info("Applying compilation output took: " + (System.currentTimeMillis() - start)); }