aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-10-15 17:33:17 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-10-16 17:11:15 +0200
commit1fb6d54e82deefb1e356e1974275c8816a676a7f (patch)
tree806ea9ca39a622dd099ff6d48042dfc83f5e580f /server/sonar-server
parent84e838af0e0f64335edf0ca0ecc4a49367cbd072 (diff)
downloadsonarqube-1fb6d54e82deefb1e356e1974275c8816a676a7f.tar.gz
sonarqube-1fb6d54e82deefb1e356e1974275c8816a676a7f.zip
add name to thread used by NotificationService
threads created by SQ should always be named to easy investigations
Diffstat (limited to 'server/sonar-server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/notification/NotificationService.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/notification/NotificationService.java b/server/sonar-server/src/main/java/org/sonar/server/notification/NotificationService.java
index 185a54e54c4..66af432960c 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/notification/NotificationService.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/notification/NotificationService.java
@@ -24,6 +24,7 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
import com.google.common.collect.SetMultimap;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -60,6 +61,7 @@ import org.sonar.db.DbClient;
})
@ServerSide
public class NotificationService implements Startable {
+ private static final String THREAD_NAME_PREFIX = "sq-notification-service-";
private static final Logger LOG = Loggers.get(NotificationService.class);
@@ -93,7 +95,12 @@ public class NotificationService implements Startable {
@Override
public void start() {
- executorService = Executors.newSingleThreadScheduledExecutor();
+ executorService =
+ Executors.newSingleThreadScheduledExecutor(
+ new ThreadFactoryBuilder()
+ .setNameFormat(THREAD_NAME_PREFIX + "%d")
+ .setPriority(Thread.MIN_PRIORITY)
+ .build());
executorService.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {