From 053ff7f9b7349d1d992dd436ebca0f7d75089464 Mon Sep 17 00:00:00 2001 From: Mikhail Mazurkevich Date: Wed, 4 Dec 2019 10:59:04 +0300 Subject: [PATCH] [jps-cache] Clear download folder and fix extract cancellation GitOrigin-RevId: ca4c1d9e6cfd331faa4ff632c87b011286020e37 --- .../intellij/jps/cache/client/TemporaryCacheServerClient.java | 3 ++- .../intellij/jps/cache/loader/JpsCompilationOutputLoader.java | 2 +- .../com/intellij/jps/cache/loader/JpsOutputLoaderManager.java | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/jps-cache/src/com/intellij/jps/cache/client/TemporaryCacheServerClient.java b/plugins/jps-cache/src/com/intellij/jps/cache/client/TemporaryCacheServerClient.java index 88b95a5991dd..bda326aaf6b1 100644 --- a/plugins/jps-cache/src/com/intellij/jps/cache/client/TemporaryCacheServerClient.java +++ b/plugins/jps-cache/src/com/intellij/jps/cache/client/TemporaryCacheServerClient.java @@ -143,8 +143,9 @@ public class TemporaryCacheServerClient implements JpsServerClient { catch (ProcessCanceledException | IOException e) { //noinspection InstanceofCatchParameter if (e instanceof IOException) LOG.warn("Failed to download JPS compilation outputs", e); + if (targetDir.exists()) FileUtil.delete(targetDir); downloadedFiles.forEach(zipFile -> FileUtil.delete(zipFile)); - return Collections.emptyList(); + return null; } } diff --git a/plugins/jps-cache/src/com/intellij/jps/cache/loader/JpsCompilationOutputLoader.java b/plugins/jps-cache/src/com/intellij/jps/cache/loader/JpsCompilationOutputLoader.java index 02fa1bdc9022..fd09f0914f4d 100644 --- a/plugins/jps-cache/src/com/intellij/jps/cache/loader/JpsCompilationOutputLoader.java +++ b/plugins/jps-cache/src/com/intellij/jps/cache/loader/JpsCompilationOutputLoader.java @@ -89,7 +89,7 @@ class JpsCompilationOutputLoader implements JpsOutputLoader> futureList = ContainerUtil.map(outputLoadResults, loadResult -> myExecutorService.submit(new UnzipOutputTask(result, loadResult, extractIndicatorManager))); - for (Future future : futureList) { + for (Future future : futureList) { future.get(); } extractIndicatorManager.finished(this); diff --git a/plugins/jps-cache/src/com/intellij/jps/cache/loader/JpsOutputLoaderManager.java b/plugins/jps-cache/src/com/intellij/jps/cache/loader/JpsOutputLoaderManager.java index 0fbf9fe5fb06..e1e677823726 100644 --- a/plugins/jps-cache/src/com/intellij/jps/cache/loader/JpsOutputLoaderManager.java +++ b/plugins/jps-cache/src/com/intellij/jps/cache/loader/JpsOutputLoaderManager.java @@ -65,9 +65,7 @@ public class JpsOutputLoaderManager { // Configure build manager BuildManager buildManager = BuildManager.getInstance(); if (!buildManager.isGeneratePortableCachesEnabled()) buildManager.setGeneratePortableCachesEnabled(true); - myExecutorService = AppExecutorUtil.createBoundedApplicationPoolExecutor("JpsCacheLoader Pool", - INSTANCE, - getThreadPoolSize()); + myExecutorService = AppExecutorUtil.createBoundedApplicationPoolExecutor("JpsCacheLoader Pool", INSTANCE, getThreadPoolSize()); } public void load(boolean isForceUpdate) {