diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2016-09-08 18:04:43 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2016-09-09 15:57:02 +0200 |
commit | 4f877fb1d54b1c4127d9063ca48c523cb51daccf (patch) | |
tree | 7aab65deca84407994098ae0e0cdb841d6d9262b /sonar-application/src/main/java/org | |
parent | 19475814aed64dd6c1f20b12fdb29a5ce90660ab (diff) | |
download | sonarqube-4f877fb1d54b1c4127d9063ca48c523cb51daccf.tar.gz sonarqube-4f877fb1d54b1c4127d9063ca48c523cb51daccf.zip |
SONAR-7909 reset sharedMemory at startup
Diffstat (limited to 'sonar-application/src/main/java/org')
-rw-r--r-- | sonar-application/src/main/java/org/sonar/application/AppFileSystem.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sonar-application/src/main/java/org/sonar/application/AppFileSystem.java b/sonar-application/src/main/java/org/sonar/application/AppFileSystem.java index cea9d9a0e3d..01c19276757 100644 --- a/sonar-application/src/main/java/org/sonar/application/AppFileSystem.java +++ b/sonar-application/src/main/java/org/sonar/application/AppFileSystem.java @@ -31,6 +31,7 @@ import java.nio.file.attribute.BasicFileAttributes; import java.util.EnumSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.sonar.process.AllProcessesCommands; import org.sonar.process.Props; import org.sonar.process.monitor.FileSystem; @@ -80,7 +81,10 @@ public class AppFileSystem implements FileSystem { createDirectory(props, PATH_DATA); createDirectory(props, PATH_WEB); createDirectory(props, PATH_LOGS); - createOrCleanTempDirectory(props, PATH_TEMP); + File tempDir = createOrCleanTempDirectory(props, PATH_TEMP); + try (AllProcessesCommands allProcessesCommands = new AllProcessesCommands(tempDir)) { + allProcessesCommands.clean(); + } } @Override @@ -119,12 +123,13 @@ public class AppFileSystem implements FileSystem { } } - private static void createOrCleanTempDirectory(Props props, String propKey) throws IOException { + private static File createOrCleanTempDirectory(Props props, String propKey) throws IOException { File dir = props.nonNullValueAsFile(propKey); LOG.info("Cleaning or creating temp directory {}", dir.getAbsolutePath()); if (!createDirectory(props, propKey)) { Files.walkFileTree(dir.toPath(), FOLLOW_LINKS, CleanTempDirFileVisitor.VISIT_MAX_DEPTH, new CleanTempDirFileVisitor(dir.toPath())); } + return dir; } private static class CleanTempDirFileVisitor extends SimpleFileVisitor<Path> { |