@VisibleForTesting
  public int getNumOfPossibleDuplicateEvents() {
    int numberOfPossibleDuplicateEvents = 0;

    for (PartitionedRegion prQ : userRegionNameToShadowPRMap.values()) {
      Set<BucketRegion> primaryBuckets = prQ.getDataStore().getAllLocalPrimaryBucketRegions();
      for (BucketRegion br : primaryBuckets) {
        BucketRegionQueue brq = (BucketRegionQueue) br;
        List<Object> objects = brq.getHelperQueueList();

        for (Object o : objects) {
          GatewaySenderEventImpl gse = (GatewaySenderEventImpl) o;
          if (gse.getPossibleDuplicate()) {
            numberOfPossibleDuplicateEvents++;
          }
        }
      }
    }
    return numberOfPossibleDuplicateEvents;
  }
Take will choose a random BucketRegionQueue which is primary and will take the head element
from it.
geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java