@Override
    public void run() {
      long lastUpdated = System.currentTimeMillis();
      try {
        while (isRunning() && keepAlive(lastUpdated)) {
          Procedure<Env> procedure = scheduler.poll(keepAliveTime, TimeUnit.MILLISECONDS);
          if (procedure == null) {
            Thread.sleep(1000);
            continue;
          }
          this.activeProcedure.set(procedure);
          activeExecutorCount.incrementAndGet();
          startTime.set(System.currentTimeMillis());
          executeProcedure(procedure);
          activeExecutorCount.decrementAndGet();
          LOG.trace(
              "Halt pid={}, activeCount={}", procedure.getProcId(), activeExecutorCount.get());
          this.activeProcedure.set(null);
          lastUpdated = System.currentTimeMillis();
          startTime.set(lastUpdated);
        }

      } catch (Exception e) {
        if (this.activeProcedure.get() != null) {
          LOG.warn(
              "Exception happened when worker {} execute procedure {}",
              getName(),
              this.activeProcedure.get(),
              e);
        }
      } finally {
        LOG.info("Procedure worker {} terminated.", getName());
      }
      workerThreads.remove(this);
    }
Add a Procedure to executor.

@param procedure procedure
@return procedure id
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/ProcedureExecutor.java