@Test public void exceptionalIterationsDoNotAffectPause() throws Exception { SweepDelay sweepDelay = new SweepDelay(100L); ScalingSweepTaskScheduler schedulerWithRealDelay = createScheduler(sweepDelay); when(sweepIteration.call()).thenReturn( SweepIterationResults.otherError(), SweepIterationResults.unableToAcquireShard(), SweepIterationResults.otherError(), SweepIterationResults.insufficientConsistency()); schedulerWithRealDelay.start(4); runSweepIterations(1); verify(sweepIteration, times(4)).call(); assertThat(sweepDelay.getNextPause(SUCCESS_MEDIUM)).isEqualTo(100L); }
void start(int initialThreads) { for (int i = 0; i < initialThreads; i++) { increaseNumberOfTasks(INITIAL_DELAY); } }
ScalingSweepTaskScheduler implements Closeable { void start(int initialThreads) { for (int i = 0; i < initialThreads; i++) { increaseNumberOfTasks(INITIAL_DELAY); } } }
ScalingSweepTaskScheduler implements Closeable { void start(int initialThreads) { for (int i = 0; i < initialThreads; i++) { increaseNumberOfTasks(INITIAL_DELAY); } } ScalingSweepTaskScheduler(
            ScheduledExecutorService executorService,
            Clock clock,
            SweepDelay delay,
            Duration coolDown,
            Callable<SweepIterationResult> singleIteration,
            BooleanSupplier scalingEnabled); }
ScalingSweepTaskScheduler implements Closeable { void start(int initialThreads) { for (int i = 0; i < initialThreads; i++) { increaseNumberOfTasks(INITIAL_DELAY); } } ScalingSweepTaskScheduler(
            ScheduledExecutorService executorService,
            Clock clock,
            SweepDelay delay,
            Duration coolDown,
            Callable<SweepIterationResult> singleIteration,
            BooleanSupplier scalingEnabled); static ScalingSweepTaskScheduler createStarted(
            SweepDelay delay,
            int initialThreads,
            Callable<SweepIterationResult> task,
            BooleanSupplier scalingEnabled); @Override void close(); }
ScalingSweepTaskScheduler implements Closeable { void start(int initialThreads) { for (int i = 0; i < initialThreads; i++) { increaseNumberOfTasks(INITIAL_DELAY); } } ScalingSweepTaskScheduler(
            ScheduledExecutorService executorService,
            Clock clock,
            SweepDelay delay,
            Duration coolDown,
            Callable<SweepIterationResult> singleIteration,
            BooleanSupplier scalingEnabled); static ScalingSweepTaskScheduler createStarted(
            SweepDelay delay,
            int initialThreads,
            Callable<SweepIterationResult> task,
            BooleanSupplier scalingEnabled); @Override void close();  }