]> source.dussan.org Git - sonarqube.git/commitdiff
Event thread must not interrupt itself when hard stopping
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 30 Aug 2019 09:13:06 +0000 (11:13 +0200)
committerSonarTech <sonartech@sonarsource.com>
Fri, 30 Aug 2019 18:21:03 +0000 (20:21 +0200)
same applies to StopWatcher thread

server/sonar-main/src/main/java/org/sonar/application/process/ManagedProcessHandler.java
server/sonar-main/src/test/java/org/sonar/application/SchedulerImplTest.java

index 861900dcc20df896d32f0d01cf3e45bd04167c28..d9b6835418d235299d2d946d08dbf48340993fc8 100644 (file)
@@ -177,8 +177,13 @@ public class ManagedProcessHandler {
   }
 
   public void stopForcibly() {
-    eventWatcher.interrupt();
-    stopWatcher.interrupt();
+    Thread currentThread = Thread.currentThread();
+    if (currentThread != eventWatcher) {
+      eventWatcher.interrupt();
+    }
+    if (currentThread != stopWatcher) {
+      stopWatcher.interrupt();
+    }
     if (process != null) {
       process.destroyForcibly();
       waitForDown();
index 1277d40ea5f859e280800ffc3000a401efec142a..533e9abc9325aab7bcb920b0d055399d4fa675a8 100644 (file)
@@ -63,7 +63,7 @@ import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_TYPE;
 public class SchedulerImplTest {
 
   @Rule
-  public TestRule safeguardTimeout = new DisableOnDebug(Timeout.seconds(300));
+  public TestRule safeguardTimeout = new DisableOnDebug(Timeout.seconds(60));
   @Rule
   public ExpectedException expectedException = ExpectedException.none();
   @Rule