protected void addDuplicateEvent(
      Map<String, Map<Integer, List<Object>>> regionToDispatchedKeysMap,
      GatewaySenderEventImpl event) {
    PartitionedRegion prQ = null;
    int bucketId = -1;
    Object key = null;
    InternalCache cache = sender.getCache();
    String regionPath = event.getRegionPath();

    if (event.getRegion() != null) {
      if (cache.getRegion(regionPath) instanceof DistributedRegion) {
        prQ = ((ParallelGatewaySenderQueue) getQueue()).getRegion(event.getRegion().getFullPath());
        bucketId = event.getEventId().getBucketID();
        key = event.getEventId();
      } else {
        prQ = ((ParallelGatewaySenderQueue) getQueue()).getRegion(ColocationHelper
            .getLeaderRegion((PartitionedRegion) event.getRegion()).getFullPath());
        bucketId = event.getBucketId();
        key = event.getShadowKey();
      }
    } else {
      Region region = (PartitionedRegion) cache.getRegion(regionPath);
      if (region != null && !region.isDestroyed()) {
        if (region instanceof DistributedRegion) {
          prQ = ((ParallelGatewaySenderQueue) getQueue()).getRegion(region.getFullPath());
          bucketId = event.getBucketId();
          key = event.getEventId();
        } else {
          prQ = ((ParallelGatewaySenderQueue) getQueue()).getRegion(
              ColocationHelper.getLeaderRegion((PartitionedRegion) region).getFullPath());
          bucketId = event.getBucketId();
          key = event.getShadowKey();
        }
      }
    }

    if (prQ == null) {
      return;
    }

    Map<Integer, List<Object>> bucketIdToDispatchedKeys =
        regionToDispatchedKeysMap.get(prQ.getFullPath());
    if (bucketIdToDispatchedKeys == null) {
      bucketIdToDispatchedKeys = new ConcurrentHashMap<>();
      regionToDispatchedKeysMap.put(prQ.getFullPath(), bucketIdToDispatchedKeys);
    }

    List<Object> dispatchedKeys = bucketIdToDispatchedKeys.get(bucketId);
    if (dispatchedKeys == null) {
      dispatchedKeys = new ArrayList<>();
      bucketIdToDispatchedKeys.put(bucketId, dispatchedKeys);
    }
    dispatchedKeys.add(key);

  }
Logs a batch of events.

@param events The batch of events to log
geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySenderEventProcessor.java