From 0e2b5bb24f1fcead00fd32e459c8756c7f9342e5 Mon Sep 17 00:00:00 2001 From: Daniel Schwarz Date: Wed, 23 Aug 2017 13:56:12 +0200 Subject: [PATCH] SONAR-9715 remove unused "pause" mode for the compute engine --- .../org/sonar/ce/queue/InternalCeQueue.java | 6 ------ .../sonar/ce/queue/InternalCeQueueImpl.java | 21 +------------------ .../ce/queue/InternalCeQueueImplTest.java | 18 ---------------- 3 files changed, 1 insertion(+), 44 deletions(-) diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueue.java b/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueue.java index 9cdc5243de9..520e5809489 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueue.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueue.java @@ -69,10 +69,4 @@ public interface InternalCeQueue extends CeQueue { void cancelWornOuts(); void resetTasksWithUnknownWorkerUUIDs(Set knownWorkerUUIDs); - - void pausePeek(); - - void resumePeek(); - - boolean isPeekPaused(); } diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java index b3eb6dfde70..49ae50087de 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java @@ -26,7 +26,6 @@ import java.io.PrintWriter; import java.util.List; import java.util.Optional; import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.apache.log4j.Logger; @@ -57,9 +56,6 @@ public class InternalCeQueueImpl extends CeQueueImpl implements InternalCeQueue private final CEQueueStatus queueStatus; private final ComputeEngineStatus computeEngineStatus; - // state - private AtomicBoolean peekPaused = new AtomicBoolean(false); - public InternalCeQueueImpl(System2 system2, DbClient dbClient, UuidFactory uuidFactory, CEQueueStatus queueStatus, DefaultOrganizationProvider defaultOrganizationProvider, ComputeEngineStatus computeEngineStatus) { super(dbClient, uuidFactory, defaultOrganizationProvider); @@ -73,7 +69,7 @@ public class InternalCeQueueImpl extends CeQueueImpl implements InternalCeQueue public Optional peek(String workerUuid) { requireNonNull(workerUuid, "workerUuid can't be null"); - if (peekPaused.get() || computeEngineStatus.getStatus() != ComputeEngineStatus.Status.STARTED) { + if (computeEngineStatus.getStatus() != ComputeEngineStatus.Status.STARTED) { return Optional.empty(); } try (DbSession dbSession = dbClient.openSession(false)) { @@ -180,21 +176,6 @@ public class InternalCeQueueImpl extends CeQueueImpl implements InternalCeQueue } } - @Override - public void pausePeek() { - this.peekPaused.set(true); - } - - @Override - public void resumePeek() { - this.peekPaused.set(false); - } - - @Override - public boolean isPeekPaused() { - return peekPaused.get(); - } - /** * A {@link PrintWriter} subclass which enforces that line returns are {@code \n} whichever the platform. */ 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 b133371f164..c54c5bbad1d 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 @@ -299,15 +299,6 @@ public class InternalCeQueueImplTest { assertThat(ceQueueDto.getWorkerUuid()).isEqualTo(WORKER_UUID_1); } - @Test - public void peek_nothing_if_paused() throws Exception { - submit(CeTaskTypes.REPORT, "PROJECT_1"); - underTest.pausePeek(); - - Optional peek = underTest.peek(WORKER_UUID_1); - assertThat(peek.isPresent()).isFalse(); - } - @Test public void peek_nothing_if_application_status_stopping() throws Exception { submit(CeTaskTypes.REPORT, "PROJECT_1"); @@ -688,15 +679,6 @@ public class InternalCeQueueImplTest { assertThat(underTest.isSubmitPaused()).isFalse(); } - @Test - public void pause_and_resume_peeks() throws Exception { - assertThat(underTest.isPeekPaused()).isFalse(); - underTest.pausePeek(); - assertThat(underTest.isPeekPaused()).isTrue(); - underTest.resumePeek(); - assertThat(underTest.isPeekPaused()).isFalse(); - } - private void verifyCeTask(CeTaskSubmit taskSubmit, CeTask task, @Nullable ComponentDto componentDto) { if (componentDto == null) { assertThat(task.getOrganizationUuid()).isEqualTo(defaultOrganizationProvider.get().getUuid()); -- 2.39.5