public synchronized void handleExit() {
    // only after closing request executor, can we clean receiver.
    requestExecutor.tryClose();
    // remove metric
    MetricService.getInstance().removeMetricSet(pipeConsensusReceiverMetrics);
    // cancel periodic task
    if (tsFileWriterCheckerFuture != null) {
      tsFileWriterCheckerFuture.cancel(false);
      tsFileWriterCheckerFuture = null;
    }
    // shutdown executor
    scheduledTsFileWriterCheckerPool.shutdownNow();
    try {
      if (!scheduledTsFileWriterCheckerPool.awaitTermination(30, TimeUnit.SECONDS)) {
        LOGGER.warn("TsFileChecker did not terminate within {}s", 30);
      }
    } catch (InterruptedException e) {
      LOGGER.warn("TsFileChecker Thread {} still doesn't exit after 30s", consensusPipeName);
      Thread.currentThread().interrupt();
    }
    // Clear the tsFileWriters, receiverBuffer and receiver base dirs
    requestExecutor.clear(false, true);
    LOGGER.info("Receiver-{} exit successfully.", consensusPipeName.toString());
  }
This method cannot be set to synchronize. Receive events can be concurrent since reqBuffer but
load event must be synchronized.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/pipeconsensus/PipeConsensusReceiver.java