public synchronized void addLogDispatcherThread(
      Peer peer, long initialSyncIndex, boolean startNow) {
    if (stopped) {
      return;
    }
    LogDispatcherThread thread = new LogDispatcherThread(peer, impl.getConfig(), initialSyncIndex);
    threads.add(thread);
    // If the initial replica is 1, the executorService won't be initialized. And when adding
    // dispatcher thread, the executorService should be initialized manually
    if (this.executorService == null) {
      initLogSyncThreadPool();
    }
    if (startNow) {
      executorService.submit(thread);
    }
  }
Manage all asynchronous replication threads and corresponding async clients.
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcher.java