@Test public void unableToAcquireShardReturnsMaxPause() { assertThat(delay.getNextPause(SweepIterationResults.unableToAcquireShard())) .isEqualTo(DEFAULT_MAX_PAUSE_MILLIS); }
long getNextPause(SweepIterationResult result) { return SweepIterationResults.caseOf(result) .success(this::updateCurrentPauseAndGet) .unableToAcquireShard_(maxPauseMillis) .insufficientConsistency_(BACKOFF) .otherError_(maxPauseMillis) .disabled_(BACKOFF); }
SweepDelay { long getNextPause(SweepIterationResult result) { return SweepIterationResults.caseOf(result) .success(this::updateCurrentPauseAndGet) .unableToAcquireShard_(maxPauseMillis) .insufficientConsistency_(BACKOFF) .otherError_(maxPauseMillis) .disabled_(BACKOFF); } }
SweepDelay { long getNextPause(SweepIterationResult result) { return SweepIterationResults.caseOf(result) .success(this::updateCurrentPauseAndGet) .unableToAcquireShard_(maxPauseMillis) .insufficientConsistency_(BACKOFF) .otherError_(maxPauseMillis) .disabled_(BACKOFF); } SweepDelay(long configPause); }
SweepDelay { long getNextPause(SweepIterationResult result) { return SweepIterationResults.caseOf(result) .success(this::updateCurrentPauseAndGet) .unableToAcquireShard_(maxPauseMillis) .insufficientConsistency_(BACKOFF) .otherError_(maxPauseMillis) .disabled_(BACKOFF); } SweepDelay(long configPause);  }
SweepDelay { long getNextPause(SweepIterationResult result) { return SweepIterationResults.caseOf(result) .success(this::updateCurrentPauseAndGet) .unableToAcquireShard_(maxPauseMillis) .insufficientConsistency_(BACKOFF) .otherError_(maxPauseMillis) .disabled_(BACKOFF); } SweepDelay(long configPause);   }