private boolean isValidStateTransition(RequestStageContainer stages, State startState,
                                         State desiredState, ServiceComponentHost host) {

    if (stages != null) {
      State projectedState = stages.getProjectedState(host.getHostName(), host.getServiceComponentName());
      startState = projectedState == null ? startState : projectedState;
    }

    return State.isValidStateTransition(startState, desiredState);
  }
Determine whether a service state change is valid.
Looks at projected state from the current stages associated with the request.


@param stages        request stages
@param startState    service start state
@param desiredState  service desired state
@param host          host where state change is occurring

@return whether the state transition is valid
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java