public synchronized void clear() {
    final List<Peer> otherPeers = peerManager.getOtherPeers(thisNode);
    final List<Peer> failedPipes =
        updateConsensusPipesStatus(new ArrayList<>(otherPeers), PipeStatus.DROPPED);
    if (!failedPipes.isEmpty()) {
      // do not roll back, because it will clear anyway
      LOGGER.warn("{} cannot drop all consensus pipes", thisNode);
    }

    MetricService.getInstance().removeMetricSet(this.pipeConsensusServerMetrics);
    peerManager.clear();
    stateMachine.stop();
    isStarted.set(false);
    active.set(false);
  }
PipeConsensusServerImpl is a consensus server implementation for pipe consensus.
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/PipeConsensusServerImpl.java