@Override
  protected void process(ClusterDistributionManager dm) {
    final boolean isDebugEnabled = logger.isDebugEnabled();
    final InternalCache cache = dm.getCache();

    if (cache == null) {
      return;
    }
    final InitializationLevel oldLevel =
        LocalRegion.setThreadInitLevelRequirement(BEFORE_INITIAL_IMAGE);
    try {
      for (String name : regionToDuplicateEventsMap.keySet()) {
        final PartitionedRegion region = (PartitionedRegion) cache.getRegion(name);
        if (region == null) {
          continue;
        }

        AbstractGatewaySender abstractSender = region.getParallelGatewaySender();
        // Find the map: bucketId to dispatchedKeys
        // Find the bucket
        // Destroy the keys
        Map<Integer, List<Object>> bucketIdToDispatchedKeys =
            this.regionToDuplicateEventsMap.get(name);
        for (Integer bId : bucketIdToDispatchedKeys.keySet()) {
          final String bucketFullPath =
              SEPARATOR + PartitionedRegionHelper.PR_ROOT_REGION_NAME + SEPARATOR
                  + region.getBucketName(bId);
          BucketRegionQueue brq =
              (BucketRegionQueue) cache.getInternalRegionByPath(bucketFullPath);

          if (brq != null && reason == STOPPED_GATEWAY_SENDER) {
            brq.setReceivedGatewaySenderStoppedMessage(true);
          }

          if (isDebugEnabled) {
            logger.debug(
                "ParallelQueueSetPossibleDuplicateMessage : The bucket in the cache is bucketRegionName : {} bucket: {}",
                bucketFullPath, brq);
          }

          List<Object> dispatchedKeys = bucketIdToDispatchedKeys.get(bId);
          if (dispatchedKeys != null && !dispatchedKeys.isEmpty()) {
            for (Object key : dispatchedKeys) {
              // First, clear the Event from tempQueueEvents at AbstractGatewaySender level, if
              // exists
              // synchronize on AbstractGatewaySender.queuedEventsSync while doing so
              abstractSender.markAsDuplicateInTempQueueEvents(key);

              if (brq != null) {
                if (isDebugEnabled) {
                  logger.debug(
                      "ParallelQueueSetPossibleDuplicateMessage : The bucket {} key {}.",
                      brq, key);
                }

                if (brq.checkIfQueueContainsKey(key)) {
                  brq.setAsPossibleDuplicate(key);
                }
              }
            }
          }
        }
      } //
    } finally {
      LocalRegion.setThreadInitLevelRequirement(oldLevel);
    }
  }
Sets events in the remote secondary queues to possible duplicate

@since Geode 1.15
geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelQueueSetPossibleDuplicateMessage.java