private Peer getLeaderPeer() {
    for (int retry = 0; retry < 50; retry++) {
      Peer leaderPeer = consensusImpl.getLeader(DEFAULT_CONSENSUS_GROUP_ID);
      if (leaderPeer != null) {
        return leaderPeer;
      }
      try {
        TimeUnit.MILLISECONDS.sleep(RETRY_WAIT_TIME_MS);
      } catch (InterruptedException e) {
        LOGGER.warn("ConsensusManager getLeaderPeer been interrupted, ", e);
        Thread.currentThread().interrupt();
      }
    }
    return null;
  }
@return ConfigNode-leader peer if leader exists, null otherwise.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java