aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-home
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2016-03-15 14:58:03 +0100
committerDuarte Meneses <duarte.meneses@sonarsource.com>2016-03-16 14:16:03 +0100
commita280429889a21f2f258041caa42264570017c31a (patch)
tree94fe06e6ddce06d238efa26b3b493e8b7a8f6969 /sonar-home
parent712c66d95af8076fe3b4efd7392a61672dc7b656 (diff)
downloadsonarqube-a280429889a21f2f258041caa42264570017c31a.tar.gz
sonarqube-a280429889a21f2f258041caa42264570017c31a.zip
SONAR-7124 Concurrent access to WS cache allowed
Diffstat (limited to 'sonar-home')
-rw-r--r--sonar-home/src/main/java/org/sonar/home/cache/DirectoryLock.java14
-rw-r--r--sonar-home/src/test/java/org/sonar/home/cache/DirectoryLockTest.java2
2 files changed, 1 insertions, 15 deletions
diff --git a/sonar-home/src/main/java/org/sonar/home/cache/DirectoryLock.java b/sonar-home/src/main/java/org/sonar/home/cache/DirectoryLock.java
index 64dcb87a10a..81c1a2b5352 100644
--- a/sonar-home/src/main/java/org/sonar/home/cache/DirectoryLock.java
+++ b/sonar-home/src/main/java/org/sonar/home/cache/DirectoryLock.java
@@ -20,16 +20,13 @@
package org.sonar.home.cache;
import java.io.IOException;
-import java.io.PrintWriter;
import java.io.RandomAccessFile;
-import java.io.StringWriter;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
-import java.nio.file.Files;
import java.nio.file.Path;
public class DirectoryLock {
- static final String LOCK_FILE_NAME = ".sonar_lock";
+ public static final String LOCK_FILE_NAME = ".sonar_lock";
private final Path lockFilePath;
private final Logger logger;
@@ -93,14 +90,5 @@ public class DirectoryLock {
logger.error("Error closing file", e);
}
}
-
- try {
- Files.delete(lockFilePath);
- } catch (IOException e) {
- // ignore, as an error happens if another process just started to acquire the same lock
- StringWriter errors = new StringWriter();
- e.printStackTrace(new PrintWriter(errors));
- logger.debug("Couldn't delete lock file: " + lockFilePath.toString() + " " + errors.toString());
- }
}
}
diff --git a/sonar-home/src/test/java/org/sonar/home/cache/DirectoryLockTest.java b/sonar-home/src/test/java/org/sonar/home/cache/DirectoryLockTest.java
index b6deb72da3e..088b7b1f2f8 100644
--- a/sonar-home/src/test/java/org/sonar/home/cache/DirectoryLockTest.java
+++ b/sonar-home/src/test/java/org/sonar/home/cache/DirectoryLockTest.java
@@ -50,7 +50,6 @@ public class DirectoryLockTest {
lock.lock();
assertThat(temp.getRoot().toPath().resolve(".sonar_lock")).exists();
lock.unlock();
- assertThat(temp.getRoot().list()).isEmpty();
}
@Test
@@ -59,7 +58,6 @@ public class DirectoryLockTest {
lock.tryLock();
assertThat(temp.getRoot().toPath().resolve(".sonar_lock")).exists();
lock.unlock();
- assertThat(temp.getRoot().list()).isEmpty();
}
@Test(expected = OverlappingFileLockException.class)