protected List createMessageList() {
      Map.Entry<String, MapWrapper> entry;
      Map.Entry<ThreadIdentifier, Long> internalEntry;
      MapWrapper threadIdToSequenceIdMap;
      String regionName;
      ThreadIdentifier tid;
      Long sequenceId;
      EventID eventId;
      List queueRemovalMessageList = new LinkedList<>();
      Iterator<Map.Entry<ThreadIdentifier, Long>> internalIterator;
      Iterator<Map.Entry<String, MapWrapper>> iterator =
          dispatchedMessagesMap.entrySet().iterator();
      while (iterator.hasNext()) {
        entry = iterator.next();
        regionName = entry.getKey(); // key will be the string
        // containing the region name
        queueRemovalMessageList.add(regionName);// add region name to the list
        // then add the number of event ids that will follow and finally the
        // event ids themselves
        threadIdToSequenceIdMap = entry.getValue();
        // take a lock since dispatcher can be adding at the same time
        // Asif: After taking the lock , change the underlying Map object
        // So that the dispatcher thread does not see the old Map object
        Map<ThreadIdentifier, Long> internalMap = threadIdToSequenceIdMap.map;
        synchronized (internalMap) {
          // remove the current threadID toSequenceMap entry from the
          // dispatchedEvenstMap
          // within the lock
          iterator.remove();
          threadIdToSequenceIdMap.map = new HashMap<>();
        }
        // ARB: Add map to removal list for durable client queues.
        /*
         * if (threadIdToSequenceIdMap.keepPrevAcks) { synchronized (threadIdToSequenceIdMap.list) {
         * threadIdToSequenceIdMap.list.add(internalMap); } }
         */
        // first add the size within the lock
        queueRemovalMessageList.add(internalMap.size());
        internalIterator = internalMap.entrySet().iterator();
        // then add the event ids to the message list within the lock
        while (internalIterator.hasNext()) {
          internalEntry = internalIterator.next();
          tid = internalEntry.getKey();
          sequenceId = internalEntry.getValue();
          eventId = new EventID(tid.getMembershipID(), tid.getThreadID(), sequenceId);
          queueRemovalMessageList.add(eventId);
        }
      }
      return queueRemovalMessageList;
    }
Creates a list containing the eventIds that have been dispatched by the clients. The QRM
thread while operating on the MapWrapper for a given region , sets a new map object so that
put operations are not blocked while the QRM thread is iterating over the map contained in
MapWrapper & the put operations will continue using the new internal Ma.
geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java