public static void checkIfRolloutCanStarted(final Rollout rollout, final Rollout mergedRollout) { if (!(Rollout.RolloutStatus.READY.equals(mergedRollout.getStatus()))) { throw new RolloutIllegalStateException("Rollout can only be started in state ready but current state is " + rollout.getStatus().name().toLowerCase()); } }
@Override @Transactional @Retryable(include = { ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY)) public void resumeRollout(final long rolloutId) { final JpaRollout rollout = getRolloutAndThrowExceptionIfNotFound(rolloutId); if (!(RolloutStatus.PAUSED.equals(rollout.getStatus()))) { throw new RolloutIllegalStateException("Rollout can only be resumed in state paused but current state is " + rollout.getStatus().name().toLowerCase()); } rollout.setStatus(RolloutStatus.RUNNING); rolloutRepository.save(rollout); }
@Override @Transactional @Retryable(include = { ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY)) public void resumeRollout(final long rolloutId) { final JpaRollout rollout = getRolloutAndThrowExceptionIfNotFound(rolloutId); if (!(RolloutStatus.PAUSED.equals(rollout.getStatus()))) { throw new RolloutIllegalStateException("Rollout can only be resumed in state paused but current state is " + rollout.getStatus().name().toLowerCase()); } rollout.setStatus(RolloutStatus.RUNNING); rolloutRepository.save(rollout); }
@Override @Transactional @Retryable(include = { ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY)) public void pauseRollout(final long rolloutId) { final JpaRollout rollout = getRolloutAndThrowExceptionIfNotFound(rolloutId); if (!RolloutStatus.RUNNING.equals(rollout.getStatus())) { throw new RolloutIllegalStateException("Rollout can only be paused in state running but current state is " + rollout.getStatus().name().toLowerCase()); } // setting the complete rollout only in paused state. This is sufficient // due the currently running groups will be completed and new groups are // not started until rollout goes back to running state again. The // periodically check for running rollouts will skip rollouts in pause // state. rollout.setStatus(RolloutStatus.PAUSED); rolloutRepository.save(rollout); }
@Override @Transactional @Retryable(include = { ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY)) public void pauseRollout(final long rolloutId) { final JpaRollout rollout = getRolloutAndThrowExceptionIfNotFound(rolloutId); if (!RolloutStatus.RUNNING.equals(rollout.getStatus())) { throw new RolloutIllegalStateException("Rollout can only be paused in state running but current state is " + rollout.getStatus().name().toLowerCase()); } // setting the complete rollout only in paused state. This is sufficient // due the currently running groups will be completed and new groups are // not started until rollout goes back to running state again. The // periodically check for running rollouts will skip rollouts in pause // state. rollout.setStatus(RolloutStatus.PAUSED); rolloutRepository.save(rollout); }