aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2019-05-02 10:51:11 +0200
committerSonarTech <sonartech@sonarsource.com>2019-06-03 20:21:19 +0200
commit4da90b373a8d8446962abaf352fcd039a0b5fad4 (patch)
tree7b9e9ca7e68d8b58feaaf6b7361de3af3db82898 /server/sonar-ce
parentd61fd1dcd624065d97212a5fc9e08cc632702281 (diff)
downloadsonarqube-4da90b373a8d8446962abaf352fcd039a0b5fad4.tar.gz
sonarqube-4da90b373a8d8446962abaf352fcd039a0b5fad4.zip
SONAR-12043 increase default timeout to 6 hours
Diffstat (limited to 'server/sonar-ce')
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfiguration.java2
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfigurationImpl.java33
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImpl.java5
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/configuration/CeConfigurationRule.java4
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java4
5 files changed, 18 insertions, 30 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfiguration.java b/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfiguration.java
index 4347f7851b2..796d9f152e8 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfiguration.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfiguration.java
@@ -50,6 +50,6 @@ public interface CeConfiguration {
/**
* Delay before stopping workers during a graceful timeout using milliseconds unit.
*/
- int getGracefulStopTimeoutInMs();
+ long getGracefulStopTimeoutInMs();
}
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfigurationImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfigurationImpl.java
index 1639b075bc9..3fb2be0c29c 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfigurationImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfigurationImpl.java
@@ -21,19 +21,18 @@ package org.sonar.ce.configuration;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-import org.picocontainer.Startable;
import org.sonar.api.config.Configuration;
import org.sonar.api.utils.MessageException;
import static java.lang.String.format;
/**
- * Immutable implementation of {@link CeConfiguration} which takes value returned by an implementation of
- * {@link WorkerCountProvider}, if any is available, or use the {@link #DEFAULT_WORKER_COUNT default worker count}.
- * In addition, it always returns {@link #DEFAULT_QUEUE_POLLING_DELAY} when
- * {@link CeConfiguration#getQueuePollingDelay()} is called.
+ * Immutable implementation of {@link CeConfiguration} initialized at startup from {@link Configuration}.
*/
-public class CeConfigurationImpl implements CeConfiguration, Startable {
+public class CeConfigurationImpl implements CeConfiguration {
+ private static final String SONAR_CE_GRACEFUL_STOP_TIME_OUT_IN_MS = "sonar.ce.gracefulStopTimeOutInMs";
+ // 6 hours
+ private static final long DEFAULT_TASK_TIMEOUT_IN_MS = 6 * 60 * 60 * 1_000L;
private static final int DEFAULT_WORKER_THREAD_COUNT = 1;
private static final int MAX_WORKER_THREAD_COUNT = 10;
private static final int DEFAULT_WORKER_COUNT = 1;
@@ -43,14 +42,11 @@ public class CeConfigurationImpl implements CeConfiguration, Startable {
private static final long CANCEL_WORN_OUTS_INITIAL_DELAY = 0;
// 2 minutes
private static final long CANCEL_WORN_OUTS_DELAY = 2;
- // 40 seconds
- private static final int GRACEFUL_STOP_TIMEOUT = 40;
- public static final String SONAR_CE_GRACEFUL_STOP_TIME_OUT_IN_MS = "sonar.ce.gracefulStopTimeOutInMs";
@CheckForNull
private final WorkerCountProvider workerCountProvider;
private final int workerThreadCount;
- private final int gracefultStopTimeoutInMs;
+ private final long gracefulStopTimeoutInMs;
private int workerCount;
public CeConfigurationImpl(Configuration configuration) {
@@ -59,7 +55,8 @@ public class CeConfigurationImpl implements CeConfiguration, Startable {
public CeConfigurationImpl(Configuration configuration, @Nullable WorkerCountProvider workerCountProvider) {
this.workerCountProvider = workerCountProvider;
- this.gracefultStopTimeoutInMs = configuration.getInt(SONAR_CE_GRACEFUL_STOP_TIME_OUT_IN_MS).orElse(GRACEFUL_STOP_TIMEOUT);
+ this.gracefulStopTimeoutInMs = configuration.getLong(SONAR_CE_GRACEFUL_STOP_TIME_OUT_IN_MS)
+ .orElse(DEFAULT_TASK_TIMEOUT_IN_MS);
if (workerCountProvider == null) {
this.workerCount = DEFAULT_WORKER_COUNT;
this.workerThreadCount = DEFAULT_WORKER_THREAD_COUNT;
@@ -84,16 +81,6 @@ public class CeConfigurationImpl implements CeConfiguration, Startable {
}
@Override
- public void start() {
- // nothing to do
- }
-
- @Override
- public void stop() {
- // nothing to do
- }
-
- @Override
public int getWorkerMaxCount() {
return workerThreadCount;
}
@@ -122,8 +109,8 @@ public class CeConfigurationImpl implements CeConfiguration, Startable {
}
@Override
- public int getGracefulStopTimeoutInMs() {
- return gracefultStopTimeoutInMs;
+ public long getGracefulStopTimeoutInMs() {
+ return gracefulStopTimeoutInMs;
}
}
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImpl.java
index acadf2196c3..b571e8c20a7 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImpl.java
@@ -35,14 +35,15 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
public class CeProcessingSchedulerImpl implements CeProcessingScheduler {
private static final Logger LOG = Loggers.get(CeProcessingSchedulerImpl.class);
- private static final long DELAY_BETWEEN_DISABLED_TASKS = 30 * 1000L; // 30 seconds
+ // 30 seconds
+ private static final long DELAY_BETWEEN_DISABLED_TASKS = 30 * 1000L;
private final CeProcessingSchedulerExecutorService executorService;
private final long delayBetweenEnabledTasks;
private final TimeUnit timeUnit;
private final ChainingCallback[] chainingCallbacks;
private final CeWorkerController ceWorkerController;
- private final int gracefulStopTimeoutInMs;
+ private final long gracefulStopTimeoutInMs;
public CeProcessingSchedulerImpl(CeConfiguration ceConfiguration,
CeProcessingSchedulerExecutorService processingExecutorService, CeWorkerFactory ceCeWorkerFactory,
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/configuration/CeConfigurationRule.java b/server/sonar-ce/src/test/java/org/sonar/ce/configuration/CeConfigurationRule.java
index ba1a0263955..1a4f1a52097 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/configuration/CeConfigurationRule.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/configuration/CeConfigurationRule.java
@@ -85,7 +85,7 @@ public class CeConfigurationRule extends ExternalResource implements CeConfigura
}
@Override
- public int getGracefulStopTimeoutInMs() {
- return 40_000;
+ public long getGracefulStopTimeoutInMs() {
+ return 6 * 60 * 60 * 1_000L;
}
}
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java
index 5a498a1119f..195a497e40e 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java
@@ -234,8 +234,8 @@ public class CeTasksMBeanImplTest {
}
@Override
- public int getGracefulStopTimeoutInMs() {
- return 40_000;
+ public long getGracefulStopTimeoutInMs() {
+ return 6 * 60 * 60 * 1_000L;
}
}