aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce/src
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-07-06 11:42:58 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-07-17 10:52:47 +0200
commit3c46dcc658fb7080eb448b3c1b969380c4d4684f (patch)
tree9df8f881f8d767d896fe4d4a266d4e9979be30fb /server/sonar-ce/src
parent06455792b2a4fa601dee1f4c085e0949cc7dd98e (diff)
downloadsonarqube-3c46dcc658fb7080eb448b3c1b969380c4d4684f.tar.gz
sonarqube-3c46dcc658fb7080eb448b3c1b969380c4d4684f.zip
SONAR-9525 use getWorkerMaxCount to configure number of threads
rather than using CeConfiguration#getWorkerCount
Diffstat (limited to 'server/sonar-ce/src')
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerExecutorServiceImpl.java2
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImpl.java2
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java5
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java2
4 files changed, 8 insertions, 3 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerExecutorServiceImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerExecutorServiceImpl.java
index 184d32cbc15..ac2b29836e3 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerExecutorServiceImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerExecutorServiceImpl.java
@@ -37,7 +37,7 @@ public class CeProcessingSchedulerExecutorServiceImpl extends AbstractStoppableE
public CeProcessingSchedulerExecutorServiceImpl(CeConfiguration ceConfiguration) {
super(
MoreExecutors.listeningDecorator(
- Executors.newScheduledThreadPool(ceConfiguration.getWorkerCount(),
+ Executors.newScheduledThreadPool(ceConfiguration.getWorkerMaxCount(),
new ThreadFactoryBuilder()
.setNameFormat(THREAD_NAME_PREFIX + "%d")
.setPriority(Thread.MIN_PRIORITY)
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 fd145a6815d..c9873e75264 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
@@ -51,7 +51,7 @@ public class CeProcessingSchedulerImpl implements CeProcessingScheduler, Startab
this.delayBetweenTasks = ceConfiguration.getQueuePollingDelay();
this.timeUnit = MILLISECONDS;
- int workerCount = ceConfiguration.getWorkerCount();
+ int workerCount = ceConfiguration.getWorkerMaxCount();
this.chainingCallbacks = new ChainingCallback[workerCount];
for (int i = 0; i < workerCount; i++) {
CeWorker worker = ceCeWorkerFactory.create();
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 0fd5c4de753..2afe062b683 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
@@ -125,6 +125,11 @@ public class CeTasksMBeanImplTest {
private static class DumbCeConfiguration implements CeConfiguration {
@Override
+ public int getWorkerMaxCount() {
+ throw new UnsupportedOperationException("getWorkerMaxCount is not implemented");
+ }
+
+ @Override
public int getWorkerCount() {
return WORKER_COUNT;
}
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java
index 355fd1c8267..4d9e8a037ea 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java
@@ -192,7 +192,7 @@ public class CeProcessingSchedulerImplTest {
@Test
public void when_workerCount_is_more_than_1_as_many_CeWorkerCallable_are_scheduled() throws Exception {
int workerCount = Math.abs(new Random().nextInt(10)) + 1;
- ceConfiguration.setWorkerCount(workerCount);
+ ceConfiguration.setWorkerThreadCount(workerCount);
CeWorker[] workers = new CeWorker[workerCount];
for (int i = 0; i < workerCount; i++) {