code: void waitForNewLeaderMessage()
        throws TimeoutException, InterruptedException, IOException {
      LOG.debug("Waiting for New Leader message from {}.", this.electedLeader);
      MessageTuple tuple = filter.getExpectedMessage(MessageType.NEW_LEADER,
                                                     this.electedLeader,
                                                     config.getTimeoutMs());
      Message msg = tuple.getMessage();
      String source = tuple.getServerId();
      if (LOG.isDebugEnabled()) {
        LOG.debug("Got message {} from {}.",
                  TextFormat.shortDebugString(msg),
                  source);
      }
      ZabMessage.NewLeader nl = msg.getNewLeader();
      long epoch = nl.getEpoch();
      Log log = persistence.getLog();
      // Sync Ack epoch to disk.
      log.sync();
      persistence.setAckEpoch(epoch);
      Message ack = MessageBuilder.buildAck(persistence.getLatestZxid());
      sendMessage(source, ack);
    }
docs: Waits for NEW_LEADER message and sends back ACK and update ACK epoch.
  
  @throws TimeoutException in case of timeout.
  @throws InterruptedException in case of interrupt.
  @throws IOException in case of IO failure.