public synchronized void stop() {
    // stop all consensus pipes
    final List<Peer> otherPeers = peerManager.getOtherPeers(thisNode);
    final List<Peer> failedPipes =
        updateConsensusPipesStatus(new ArrayList<>(otherPeers), PipeStatus.STOPPED);
    if (!failedPipes.isEmpty()) {
      // do not roll back, because it will stop anyway
      LOGGER.warn("{} cannot stop all consensus pipes", thisNode);
    }
    MetricService.getInstance().removeMetricSet(this.pipeConsensusServerMetrics);
    stateMachine.stop();
    isStarted.set(false);
  }
PipeConsensusServerImpl is a consensus server implementation for pipe consensus.
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/PipeConsensusServerImpl.java