@Test public void testFailedUpdate() { expect(strategy.getNextGroup(ImmutableSet.of(0, 1, 2, 3), EMPTY)) .andReturn(ImmutableSet.of(0, 1)); String s0 = "0"; String s1 = "1"; expectFetchAndEvaluate( 0, instance0, s0, FAILED_TERMINATED); expectFetchAndEvaluate( 1, instance1, s1, KILL_TASK_AND_EVALUATE_ON_STATE_CHANGE); control.replay(); jobUpdater = new OneWayJobUpdater<>(strategy, 0, allInstances); evaluate( OneWayStatus.FAILED, ImmutableMap.of( 0, sideEffect(InstanceUpdateStatus.WORKING, InstanceUpdateStatus.FAILED), 1, sideEffect(KILL_TASK, InstanceUpdateStatus.WORKING))); try { jobUpdater.evaluate(ImmutableMap.of(), stateProvider); fail(); } catch (IllegalStateException e) { } }
synchronized EvaluationResult<K> evaluate( Map<K, T> instancesNeedingUpdate, InstanceStateProvider<K, T> stateProvider) { if (stateMachine.getState() == OneWayStatus.IDLE) { stateMachine.transition(OneWayStatus.WORKING); } Preconditions.checkState( stateMachine.getState() == OneWayStatus.WORKING, "Attempted to evaluate an inactive job updater."); ImmutableMap.Builder<K, SideEffect> actions = ImmutableMap.<K, SideEffect>builder() .putAll(evaluateInstances(instancesNeedingUpdate)); if (computeJobUpdateStatus() == OneWayStatus.WORKING) { actions.putAll(startNextInstanceGroup(stateProvider)); } return new EvaluationResult<>(computeJobUpdateStatus(), actions.build()); }
OneWayJobUpdater { synchronized EvaluationResult<K> evaluate( Map<K, T> instancesNeedingUpdate, InstanceStateProvider<K, T> stateProvider) { if (stateMachine.getState() == OneWayStatus.IDLE) { stateMachine.transition(OneWayStatus.WORKING); } Preconditions.checkState( stateMachine.getState() == OneWayStatus.WORKING, "Attempted to evaluate an inactive job updater."); ImmutableMap.Builder<K, SideEffect> actions = ImmutableMap.<K, SideEffect>builder() .putAll(evaluateInstances(instancesNeedingUpdate)); if (computeJobUpdateStatus() == OneWayStatus.WORKING) { actions.putAll(startNextInstanceGroup(stateProvider)); } return new EvaluationResult<>(computeJobUpdateStatus(), actions.build()); } }
OneWayJobUpdater { synchronized EvaluationResult<K> evaluate( Map<K, T> instancesNeedingUpdate, InstanceStateProvider<K, T> stateProvider) { if (stateMachine.getState() == OneWayStatus.IDLE) { stateMachine.transition(OneWayStatus.WORKING); } Preconditions.checkState( stateMachine.getState() == OneWayStatus.WORKING, "Attempted to evaluate an inactive job updater."); ImmutableMap.Builder<K, SideEffect> actions = ImmutableMap.<K, SideEffect>builder() .putAll(evaluateInstances(instancesNeedingUpdate)); if (computeJobUpdateStatus() == OneWayStatus.WORKING) { actions.putAll(startNextInstanceGroup(stateProvider)); } return new EvaluationResult<>(computeJobUpdateStatus(), actions.build()); } OneWayJobUpdater(
      UpdateStrategy<K> strategy,
      int maxFailedInstances,
      Map<K, StateEvaluator<T>> instanceEvaluators); }
OneWayJobUpdater { synchronized EvaluationResult<K> evaluate( Map<K, T> instancesNeedingUpdate, InstanceStateProvider<K, T> stateProvider) { if (stateMachine.getState() == OneWayStatus.IDLE) { stateMachine.transition(OneWayStatus.WORKING); } Preconditions.checkState( stateMachine.getState() == OneWayStatus.WORKING, "Attempted to evaluate an inactive job updater."); ImmutableMap.Builder<K, SideEffect> actions = ImmutableMap.<K, SideEffect>builder() .putAll(evaluateInstances(instancesNeedingUpdate)); if (computeJobUpdateStatus() == OneWayStatus.WORKING) { actions.putAll(startNextInstanceGroup(stateProvider)); } return new EvaluationResult<>(computeJobUpdateStatus(), actions.build()); } OneWayJobUpdater(
      UpdateStrategy<K> strategy,
      int maxFailedInstances,
      Map<K, StateEvaluator<T>> instanceEvaluators);  }
OneWayJobUpdater { synchronized EvaluationResult<K> evaluate( Map<K, T> instancesNeedingUpdate, InstanceStateProvider<K, T> stateProvider) { if (stateMachine.getState() == OneWayStatus.IDLE) { stateMachine.transition(OneWayStatus.WORKING); } Preconditions.checkState( stateMachine.getState() == OneWayStatus.WORKING, "Attempted to evaluate an inactive job updater."); ImmutableMap.Builder<K, SideEffect> actions = ImmutableMap.<K, SideEffect>builder() .putAll(evaluateInstances(instancesNeedingUpdate)); if (computeJobUpdateStatus() == OneWayStatus.WORKING) { actions.putAll(startNextInstanceGroup(stateProvider)); } return new EvaluationResult<>(computeJobUpdateStatus(), actions.build()); } OneWayJobUpdater(
      UpdateStrategy<K> strategy,
      int maxFailedInstances,
      Map<K, StateEvaluator<T>> instanceEvaluators);   }