public synchronized void stop() {
    if (status == null) {
      throw new PipeException(MESSAGE_PIPE_TASK_STAGE_HAS_NOT_BEEN_CREATED);
    }
    if (status == PipeStatus.STOPPED) {
      // Do nothing to allow retry strategy
      return;
    }
    if (status == PipeStatus.DROPPED) {
      throw new PipeException(MESSAGE_PIPE_TASK_STAGE_HAS_BEEN_DROPPED);
    }

    // status == PipeStatus.RUNNING, stop the connector
    stopSubtask();

    status = PipeStatus.STOPPED;
    hasBeenExternallyStopped = true;
  }
Stop a {@link PipeTaskStage}.

@throws PipeException if failed to stop a {@link PipeTaskStage}.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/stage/PipeTaskStage.java