aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce/src/main/java
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-07-05 10:41:49 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-07-17 10:52:47 +0200
commitb2697bca004c5d72d5539233b7780faa9fe06df6 (patch)
tree40c706fa6d7535fd1e8edb7dfd91f7826a07766f /server/sonar-ce/src/main/java
parentce973089af35b80082b7f6a169f3a976f00f6ec4 (diff)
downloadsonarqube-b2697bca004c5d72d5539233b7780faa9fe06df6.tar.gz
sonarqube-b2697bca004c5d72d5539233b7780faa9fe06df6.zip
SONAR-9507 add warning at CE startup if sonar.ce.workerCount exists
Diffstat (limited to 'server/sonar-ce/src/main/java')
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeWorkerCountSettingWarning.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeWorkerCountSettingWarning.java b/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeWorkerCountSettingWarning.java
new file mode 100644
index 00000000000..018e017028c
--- /dev/null
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeWorkerCountSettingWarning.java
@@ -0,0 +1,53 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program 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.
+ *
+ * This program 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.ce.configuration;
+
+import org.picocontainer.Startable;
+import org.sonar.api.config.Configuration;
+import org.sonar.api.utils.log.Logger;
+import org.sonar.api.utils.log.Loggers;
+
+/**
+ * Displays a warning in the logs if property "sonar.ce.workerCount" is defined as it has been replaced
+ * by an internal property (see SONAR-9507).
+ */
+public class CeWorkerCountSettingWarning implements Startable {
+ private static final String PROPERTY_SONAR_CE_WORKER_COUNT = "sonar.ce.workerCount";
+ private static final Logger LOG = Loggers.get(CeWorkerCountSettingWarning.class);
+
+ private final Configuration configuration;
+
+ public CeWorkerCountSettingWarning(Configuration configuration) {
+ this.configuration = configuration;
+ }
+
+ @Override
+ public void start() {
+ configuration.get(PROPERTY_SONAR_CE_WORKER_COUNT)
+ .ifPresent(workerCount -> LOG.warn("Property {} is not supported anymore and will be ignored." +
+ " Remove it from sonar.properties to remove this warning.",
+ PROPERTY_SONAR_CE_WORKER_COUNT));
+ }
+
+ @Override
+ public void stop() {
+ // nothing to do
+ }
+}