@Override
  protected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException {
    StateMachineProcedureData data = serializer.deserialize(StateMachineProcedureData.class);
    stateCount = data.getStateCount();
    if (stateCount > 0) {
      states = new int[stateCount];
      for (int i = 0; i < stateCount; ++i) {
        states[i] = data.getState(i);
      }
      if (isEofState()) {
        stateFlow = Flow.NO_MORE_STATE;
      }
    } else {
      states = null;
    }
  }
Set the next state for the procedure.
@param stateId the ordinal() of the state enum (or state id)
hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/StateMachineProcedure.java