aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-home/src/main/java/org
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2015-06-23 18:19:49 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2015-06-23 18:26:13 +0200
commit299ceccf44a002e73fcdf8d7333456237e600b7a (patch)
tree0ba9ad0874fbf7af94d23cb0e9b30d2ab5c707aa /sonar-home/src/main/java/org
parent8b38a0ea417b681ef2553ba29870fa5933908007 (diff)
downloadsonarqube-299ceccf44a002e73fcdf8d7333456237e600b7a.tar.gz
sonarqube-299ceccf44a002e73fcdf8d7333456237e600b7a.zip
Revert merge to d70f025
Diffstat (limited to 'sonar-home/src/main/java/org')
-rw-r--r--sonar-home/src/main/java/org/sonar/home/cache/PersistentCache.java8
-rw-r--r--sonar-home/src/main/java/org/sonar/home/cache/PersistentCacheBuilder.java8
-rw-r--r--sonar-home/src/main/java/org/sonar/home/log/LogListener.java28
3 files changed, 5 insertions, 39 deletions
diff --git a/sonar-home/src/main/java/org/sonar/home/cache/PersistentCache.java b/sonar-home/src/main/java/org/sonar/home/cache/PersistentCache.java
index 3ceeaa47f3d..a5d88ffcbe9 100644
--- a/sonar-home/src/main/java/org/sonar/home/cache/PersistentCache.java
+++ b/sonar-home/src/main/java/org/sonar/home/cache/PersistentCache.java
@@ -52,19 +52,15 @@ public class PersistentCache {
// eviction strategy is to expire entries after modification once a time duration has elapsed
private final long defaultDurationToExpireMs;
private final Log log;
- private boolean forceUpdate;
+ private final boolean forceUpdate;
public PersistentCache(Path baseDir, long defaultDurationToExpireMs, Log log, boolean forceUpdate) {
this.baseDir = baseDir;
this.defaultDurationToExpireMs = defaultDurationToExpireMs;
this.log = log;
+ this.forceUpdate = forceUpdate;
- reconfigure(forceUpdate);
log.info("cache: " + baseDir + ", default expiration time (ms): " + defaultDurationToExpireMs);
- }
-
- public void reconfigure(boolean forceUpdate) {
- this.forceUpdate = forceUpdate;
if (forceUpdate) {
log.debug("cache: forcing update");
diff --git a/sonar-home/src/main/java/org/sonar/home/cache/PersistentCacheBuilder.java b/sonar-home/src/main/java/org/sonar/home/cache/PersistentCacheBuilder.java
index c58dc53bbd6..c8fcf06d4d0 100644
--- a/sonar-home/src/main/java/org/sonar/home/cache/PersistentCacheBuilder.java
+++ b/sonar-home/src/main/java/org/sonar/home/cache/PersistentCacheBuilder.java
@@ -30,19 +30,17 @@ import java.nio.file.Paths;
import java.util.concurrent.TimeUnit;
public class PersistentCacheBuilder {
- private static final long DEFAULT_EXPIRE_DURATION = TimeUnit.MILLISECONDS.convert(1L, TimeUnit.DAYS);
- private static final String DIR_NAME = "ws_cache";
-
private boolean forceUpdate = false;
private Path cachePath = null;
private Log log = new StandardLog();
+ private String name = "ws_cache";
public PersistentCache build() {
if (cachePath == null) {
setSonarHome(findHome());
}
- return new PersistentCache(cachePath, DEFAULT_EXPIRE_DURATION, log, forceUpdate);
+ return new PersistentCache(cachePath, TimeUnit.MILLISECONDS.convert(1L, TimeUnit.DAYS), log, forceUpdate);
}
public PersistentCacheBuilder setLog(Log log) {
@@ -52,7 +50,7 @@ public class PersistentCacheBuilder {
public PersistentCacheBuilder setSonarHome(@Nullable Path p) {
if (p != null) {
- this.cachePath = p.resolve(DIR_NAME);
+ this.cachePath = p.resolve(name);
}
return this;
}
diff --git a/sonar-home/src/main/java/org/sonar/home/log/LogListener.java b/sonar-home/src/main/java/org/sonar/home/log/LogListener.java
deleted file mode 100644
index fa11374fdc4..00000000000
--- a/sonar-home/src/main/java/org/sonar/home/log/LogListener.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.home.log;
-
-public interface LogListener {
- void log(String msg, Level level);
-
- enum Level {
- ERROR, WARN, INFO, DEBUG, TRACE;
- }
-}