code: private void doAck(long id) {
      // The other side of the connection has sent a message indicating which
      // messages it has seen. We can clear any messages before the indicated ID.
      if (log.isDebugEnabled()) {
        log.debug(String.format("%s - Received ack for messages up to %d, removing all previous messages from memory", this, id));
      }
      if (messages.containsKey(id+1)) {
        messages.tailMap(id+1);
      } else {
        messages.clear();
      }
      checkDrain();
    }
docs: Handles a batch ack.