public static List<PartitionedRegion> getColocatedChildRegions(
      PartitionedRegion partitionedRegion) {
    List<PartitionedRegion> colocatedChildRegions = new ArrayList<>();
    Region prRoot = PartitionedRegionHelper.getPRRoot(partitionedRegion.getCache());
    PartitionRegionConfig prConf = null;
    // final List allPRNamesList = new ArrayList(prRoot.keySet());
    Iterator itr = prRoot.keySet().iterator();
    while (itr.hasNext()) {
      try {
        String prName = (String) itr.next();
        if (prName.equals(partitionedRegion.getRegionIdentifier())) {
          // region can't be a child of itself
          continue;
        }
        try {
          prConf = (PartitionRegionConfig) prRoot.get(prName);
        } catch (EntryDestroyedException ignore) {
          continue;
        }
        if (prConf == null) {
          // darrel says: I'm seeing an NPE in this code after pr->rem
          // merge so I added this check and continue
          continue;
        }
        int prID = prConf.getPRId();
        PartitionedRegion prRegion = PartitionedRegion.getPRFromId(prID);
        if (prRegion != null) {
          if (prRegion.getColocatedWith() != null) {
            if (prRegion.getColocatedWith().equals(partitionedRegion.getFullPath())
                || (SEPARATOR + prRegion.getColocatedWith())
                    .equals(partitionedRegion.getFullPath())) {
              // only regions directly colocatedWith partitionedRegion are
              // added to the list...
              prRegion.waitOnBucketMetadataInitialization();
              colocatedChildRegions.add(prRegion);
            }
          }
        }
      } catch (PRLocallyDestroyedException e) {
        if (logger.isDebugEnabled()) {
          logger.debug("PRLocallyDestroyedException : Region ={} is locally destroyed on this node",
              prConf.getPRId(), e);
        }
      } catch (RegionDestroyedException e) {
        if (logger.isDebugEnabled()) {
          logger.debug("RegionDestroyedException : Region ={} is destroyed.", prConf.getPRId(), e);
        }
      }
    }

    // Fix for 44484 - Make the list of colocated child regions
    // is always in the same order on all nodes.
    Collections.sort(colocatedChildRegions, (o1, o2) -> {
      if (o1.isShadowPR() == o2.isShadowPR()) {
        return o1.getFullPath().compareTo(o2.getFullPath());
      }
      if (o1.isShadowPR()) {
        return 1;
      }
      return -1;
    });
    return colocatedChildRegions;
  }
A utility method to retrieve all child partitioned regions that are directly colocated to the
specified partitioned region.<br>
<p>
For example, shipmentPR is colocated with orderPR and orderPR is colocated with customerPR.
<br>
getColocatedChildRegions(customerPR) will return List{orderPR}<br>
getColocatedChildRegions(orderPR) will return List{shipmentPR}<br>
getColocatedChildRegions(shipmentPR) will return empty List{}<br>

@return list of all child partitioned regions colocated with the region
@since GemFire 5.8Beta
geode-core/src/main/java/org/apache/geode/internal/cache/ColocationHelper.java