@Override
  protected void serializeStateData(ProcedureStateSerializer serializer) throws IOException {
    StateMachineProcedureData.Builder data = StateMachineProcedureData.newBuilder();
    for (int i = 0; i < stateCount; ++i) {
      data.addState(states[i]);
    }
    serializer.serialize(data.build());
  }
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