@Override
  protected Procedure[] execute(final TEnvironment env)
    throws ProcedureSuspendedException, ProcedureYieldException, InterruptedException {
    updateTimestamp();
    try {
      failIfAborted();

      if (!hasMoreState() || isFailed()) {
        return null;
      }

      TState state = getCurrentState();
      if (stateCount == 0) {
        setNextState(getStateId(state));
      }

      if (LOG.isTraceEnabled()) {
        LOG.trace(state + " " + this + "; cycles=" + this.cycles);
      }
      // Keep running count of cycles
      if (getStateId(state) != this.previousState) {
        this.previousState = getStateId(state);
        this.cycles = 0;
      } else {
        this.cycles++;
      }

      LOG.trace("{}", this);
      stateFlow = executeFromState(env, state);
      if (!hasMoreState()) {
        setNextState(EOF_STATE);
      }

      if (subProcList != null && !subProcList.isEmpty()) {
        Procedure[] subProcedures = subProcList.toArray(new Procedure[subProcList.size()]);
        subProcList = null;
        return subProcedures;
      }
      return (isWaiting() || isFailed() || !hasMoreState()) ? null : new Procedure[] { this };
    } finally {
      updateTimestamp();
    }
  }
Add a child procedure to execute
@param subProcedure the child procedure
hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/StateMachineProcedure.java