void validateColocation(Cache cache) {
    if (colocatedRegionName == null) {
      return;
    }
    if (cache != null) {
      Region<?, ?> region = cache.getRegion(colocatedRegionName);
      if (region == null) {
        throw new IllegalStateException(
            "Region specified in 'colocated-with' is not present. It should be created before setting 'colocated-with' to this region.");
      }
      if (!(region instanceof PartitionedRegion)) {
        throw new IllegalStateException(
            "Setting the attribute 'colocated-with' is supported only for PartitionedRegions");
      }
      PartitionedRegion colocatedRegion = (PartitionedRegion) region;
      if (getTotalNumBuckets() != colocatedRegion.getPartitionAttributes()
          .getTotalNumBuckets()) {
        throw new IllegalStateException(
            "Current PartitionedRegion's TotalNumBuckets should be same as TotalNumBuckets of colocated PartitionedRegion");
      }
      if (getRedundancy() != colocatedRegion.getPartitionAttributes().getRedundantCopies()) {
        throw new IllegalStateException(
            "Current PartitionedRegion's redundancy should be same as the redundancy of colocated PartitionedRegion");
      }
    }
  }
Validates colocation of PartitionRegion <br>
This method used to be called when the RegionAttributes were created. But this was too early
since the region we are colocated with might not exist (yet). So it is now called when the PR
using these attributes is created. See bug 47197.

1. region passed in setColocatedWith should exist.<br>
2. region passed should be of a PartitionedRegion <br>
3. Custom partitioned should be enabled for colocated regions <br>
4. totalNumBuckets should be same for colocated regions<br>
5. redundancy of colocated regions should be same<br>

@since GemFire 5.8Beta
geode-core/src/main/java/org/apache/geode/internal/cache/PartitionAttributesImpl.java