code: void waitForCommitMessage()
        throws TimeoutException, InterruptedException, IOException {
      LOG.debug("Waiting for commit message from {}", this.electedLeader);
      MessageTuple tuple = filter.getExpectedMessage(MessageType.COMMIT,
                                                     this.electedLeader,
                                                     config.getTimeoutMs());
      Zxid zxid = MessageBuilder.fromProtoZxid(tuple.getMessage()
                                                    .getCommit()
                                                    .getZxid());
      Zxid lastZxid = persistence.getLatestZxid();
      // If the followers are appropriately synchronized, the Zxid of ACK should
      // match the last Zxid in followers' log.
      if (zxid.compareTo(lastZxid) != 0) {
        LOG.error("The ACK zxid {} doesn't match last zxid {} in log!",
                  zxid,
                  lastZxid);
        throw new RuntimeException("The ACK zxid doesn't match last zxid");
      }
    }
docs: Wait for a commit message from the leader.
  
  @throws TimeoutException in case of timeout.
  @throws InterruptedException in case of interruption.
  @throws IOException in case of IO failures.