aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-07-28 17:23:53 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-07-28 17:24:36 +0400
commit5eebafaa38165ad415256c586e31ebe6bb318c4d (patch)
treef209499c5c8d2bce243957773ce23c7a1bb98345
parent523e36a5289ef7e21c5900335656783f2f0473dd (diff)
downloadsonarqube-5eebafaa38165ad415256c586e31ebe6bb318c4d.tar.gz
sonarqube-5eebafaa38165ad415256c586e31ebe6bb318c4d.zip
Improve shutdown of NotificationService
-rw-r--r--sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java b/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java
index 88184e1ed23..ae4f45f507a 100644
--- a/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java
+++ b/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java
@@ -59,6 +59,8 @@ public class NotificationService implements ServerComponent {
private NotificationChannel[] channels;
private NotificationDispatcher[] dispatchers;
+ private boolean stopping = false;
+
/**
* Default constructor when no channels.
*/
@@ -86,7 +88,8 @@ public class NotificationService implements ServerComponent {
public void stop() {
try {
- executorService.awaitTermination(delay, TimeUnit.SECONDS);
+ stopping = true;
+ executorService.awaitTermination(5, TimeUnit.SECONDS);
executorService.shutdown();
} catch (InterruptedException e) {
Logs.INFO.error("Error during stop of notification service", e);
@@ -102,6 +105,9 @@ public class NotificationService implements ServerComponent {
NotificationQueueElement queueElement = manager.getFromQueue();
while (queueElement != null) {
deliver(queueElement.getNotification());
+ if (stopping) {
+ break;
+ }
queueElement = manager.getFromQueue();
}
TIME_PROFILER.stop();