]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9715 remove unused "pause" mode for the compute engine
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>
Wed, 23 Aug 2017 11:56:12 +0000 (13:56 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 5 Sep 2017 12:24:13 +0000 (14:24 +0200)
server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueue.java
server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java
server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java

index 9cdc5243de9a3b95c072429008aadd4fd07dadc9..520e5809489692c6054f009a04244d206a738691 100644 (file)
@@ -69,10 +69,4 @@ public interface InternalCeQueue extends CeQueue {
   void cancelWornOuts();
 
   void resetTasksWithUnknownWorkerUUIDs(Set<String> knownWorkerUUIDs);
-
-  void pausePeek();
-
-  void resumePeek();
-
-  boolean isPeekPaused();
 }
index b3eb6dfde70155046a49049a3ef48982563c1a32..49ae50087dee00ed249a0160cc30dbb42a733144 100644 (file)
@@ -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<CeTask> 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.
    */
index b133371f164b685dc4e072072cd7a509eff6db09..c54c5bbad1da28bef750226bcc3b8c405f9f21db 100644 (file)
@@ -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<CeTask> 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());