@Override
  protected Procedure<Env>[] execute(final Env env) throws InterruptedException {
    updateTimestamp();
    try {
      if (noMoreState() || isFailed()) {
        return null;
      }

      TState state = getCurrentState();

      // init for the first execution
      if (states.isEmpty()) {
        setNextState(getStateId(state));
        addNextStateAndCalculateCycles();
      }

      LOG.trace("{}", this);
      stateFlow = executeFromState(env, state);
      if (!isFailed()) {
        addNextStateAndCalculateCycles();
      }
      setStateDeserialized(false);

      if (!subProcList.isEmpty()) {
        Procedure<Env>[] subProcedures = subProcList.toArray(new Procedure[0]);
        subProcList.clear();
        return subProcedures;
      }
      return (isWaiting() || isFailed() || noMoreState()) ? null : new Procedure[] {this};
    } finally {
      updateTimestamp();
    }
  }
Add a child procedure to execute.

@param childProcedure the child procedure
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/StateMachineProcedure.java