aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2019-05-03 13:43:12 +0200
committerSonarTech <sonartech@sonarsource.com>2019-06-03 20:21:20 +0200
commitd1b7b7fe1da734dbaedb805f31953a81927b85d8 (patch)
treebc92d4d9e8d5e59a1cd4253bf9c1a803c6f2958c
parent16859cefcd463d5c9d3a6c9f3b46533dbcf0854b (diff)
downloadsonarqube-d1b7b7fe1da734dbaedb805f31953a81927b85d8.tar.gz
sonarqube-d1b7b7fe1da734dbaedb805f31953a81927b85d8.zip
SONAR-12043 change restartDisabled to restarting for easier understanding
this internal flag of class SchedulerImpl is easier to understand with this name
-rw-r--r--server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java b/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java
index ad6f315c43c..9431f3a9565 100644
--- a/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java
+++ b/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java
@@ -56,7 +56,7 @@ public class SchedulerImpl implements Scheduler, ProcessEventListener, ProcessLi
private final CountDownLatch awaitTermination = new CountDownLatch(1);
private final AtomicBoolean firstWaitingEsLog = new AtomicBoolean(true);
private final AtomicBoolean restartRequested = new AtomicBoolean(false);
- private final AtomicBoolean restartDisabled = new AtomicBoolean(false);
+ private final AtomicBoolean restarting = new AtomicBoolean(false);
private final EnumMap<ProcessId, SQProcess> processesById = new EnumMap<>(ProcessId.class);
private final AtomicInteger operationalCountDown = new AtomicInteger();
private final AtomicInteger stopCountDown = new AtomicInteger(0);
@@ -191,9 +191,8 @@ public class SchedulerImpl implements Scheduler, ProcessEventListener, ProcessLi
*/
@Override
public void hardStop() {
- // disable ability to request for restart
restartRequested.set(false);
- restartDisabled.set(true);
+ restarting.set(false);
if (nodeLifecycle.tryToMoveTo(NodeLifecycle.State.STOPPING)) {
LOG.info("Stopping SonarQube");
@@ -222,6 +221,7 @@ public class SchedulerImpl implements Scheduler, ProcessEventListener, ProcessLi
if (type == Type.OPERATIONAL) {
onProcessOperational(processId);
} else if (type == Type.ASK_FOR_RESTART && restartRequested.compareAndSet(false, true)) {
+ restarting.set(true);
hardStopAsync();
}
}
@@ -245,7 +245,7 @@ public class SchedulerImpl implements Scheduler, ProcessEventListener, ProcessLi
public void onProcessState(ProcessId processId, Lifecycle.State to) {
switch (to) {
case STOPPED:
- onProcessHardStop(processId);
+ onProcessStop(processId);
break;
case STARTING:
stopCountDown.incrementAndGet();
@@ -256,11 +256,10 @@ public class SchedulerImpl implements Scheduler, ProcessEventListener, ProcessLi
}
}
- private void onProcessHardStop(ProcessId processId) {
+ private void onProcessStop(ProcessId processId) {
LOG.info("Process [{}] is stopped", processId.getKey());
if (stopCountDown.decrementAndGet() == 0 && nodeLifecycle.tryToMoveTo(NodeLifecycle.State.STOPPED)) {
- if (!restartDisabled.get() &&
- restartRequested.compareAndSet(true, false)) {
+ if (restarting.get() && restartRequested.compareAndSet(true, false)) {
LOG.info("SonarQube is restarting");
restartAsync();
} else {