aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce/src
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2019-05-02 12:26:06 +0200
committerSonarTech <sonartech@sonarsource.com>2019-06-03 20:21:19 +0200
commit0e90581357a2a9e0a8604246b121a98e4d30d646 (patch)
tree79dcea0792542a4ae9cf892fdade9e352425ce7c /server/sonar-ce/src
parentd803a7b56badb25efe47ee26e842d7196ba7a419 (diff)
downloadsonarqube-0e90581357a2a9e0a8604246b121a98e4d30d646.tar.gz
sonarqube-0e90581357a2a9e0a8604246b121a98e4d30d646.zip
SONAR-12043 rename current shutdown code from stop to hardStop
Diffstat (limited to 'server/sonar-ce/src')
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/ComputeEngineImpl.java4
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java2
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineStatus.java2
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java6
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java4
5 files changed, 9 insertions, 9 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/ComputeEngineImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/ComputeEngineImpl.java
index 82d9faec4ad..5455c2d3d59 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/ComputeEngineImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/ComputeEngineImpl.java
@@ -53,7 +53,7 @@ public class ComputeEngineImpl implements ComputeEngine, ComputeEngineStatus {
checkStateAsShutdown(this.status);
try {
- this.status = Status.STOPPING;
+ this.status = Status.HARD_STOPPING;
this.computeEngineContainer.stop();
} finally {
this.status = Status.STOPPED;
@@ -62,7 +62,7 @@ public class ComputeEngineImpl implements ComputeEngine, ComputeEngineStatus {
private static void checkStateAsShutdown(Status currentStatus) {
checkState(currentStatus.ordinal() >= Status.STARTED.ordinal(), "shutdown() must not be called before startup()");
- checkState(currentStatus.ordinal() <= Status.STOPPING.ordinal(), "shutdown() can not be called multiple times");
+ checkState(currentStatus.ordinal() <= Status.HARD_STOPPING.ordinal(), "shutdown() can not be called multiple times");
}
@Override
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java b/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java
index 54725ecd5a5..9dfdd355547 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java
@@ -105,7 +105,7 @@ public class CeServer implements Monitored {
}
@Override
- public void stop() {
+ public void hardStop() {
if (ceMainThread != null) {
// signal main Thread to stop
ceMainThread.stopIt();
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineStatus.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineStatus.java
index a8bbc8e449a..fab7b524340 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineStatus.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineStatus.java
@@ -30,6 +30,6 @@ public interface ComputeEngineStatus {
Status getStatus();
enum Status {
- INIT, STARTING, STARTED, STOPPING, STOPPED
+ INIT, STARTING, STARTED, HARD_STOPPING, STOPPED
}
}
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java
index 1d1f586c778..477b088d828 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java
@@ -54,7 +54,7 @@ public class CeServerTest {
@After
public void tearDown() throws Exception {
if (underTest != null) {
- underTest.stop();
+ underTest.hardStop();
}
Thread waitingThread = this.waitingThread;
this.waitingThread = null;
@@ -190,7 +190,7 @@ public class CeServerTest {
assertThat(waitingThread.isAlive()).isTrue();
}
- ceServer.stop();
+ ceServer.hardStop();
// wait for waiting thread to stop because we stopped ceServer
// if it does not, the test will fail with timeout
waitingThread.join();
@@ -232,7 +232,7 @@ public class CeServerTest {
ceServer.start();
waitingThread.start();
- ceServer.stop();
+ ceServer.hardStop();
// wait for waiting thread to stop because we stopped ceServer
// if it does not, the test will fail with timeout
waitingThread.join();
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java
index e54545f4181..f32219888ee 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java
@@ -62,7 +62,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import static org.sonar.ce.container.ComputeEngineStatus.Status.STARTED;
-import static org.sonar.ce.container.ComputeEngineStatus.Status.STOPPING;
+import static org.sonar.ce.container.ComputeEngineStatus.Status.HARD_STOPPING;
public class InternalCeQueueImplTest {
@@ -407,7 +407,7 @@ public class InternalCeQueueImplTest {
@Test
public void peek_nothing_if_application_status_stopping() {
submit(CeTaskTypes.REPORT, newProjectDto("PROJECT_1"));
- when(computeEngineStatus.getStatus()).thenReturn(STOPPING);
+ when(computeEngineStatus.getStatus()).thenReturn(HARD_STOPPING);
Optional<CeTask> peek = underTest.peek(WORKER_UUID_1);
assertThat(peek.isPresent()).isFalse();