static RegionLocations removeRegionLocation(RegionLocations oldLocs, int replicaId) {
    HRegionLocation[] locs = oldLocs.getRegionLocations();
    if (locs.length < replicaId + 1) {
      // Here we do not modify the oldLocs so it is safe to return it.
      return oldLocs;
    }
    locs = Arrays.copyOf(locs, locs.length);
    locs[replicaId] = null;
    if (ObjectUtils.firstNonNull(locs) != null) {
      return new RegionLocations(locs);
    } else {
      // if all the locations are null, just return null
      return null;
    }
  }
Create a new {@link RegionLocations} based on the given {@code oldLocs}, and remove the
location for the given {@code replicaId}.
<p/>
All the {@link RegionLocations} in async locator related class are immutable because we want to
access them concurrently, so here we need to create a new one, instead of calling
{@link RegionLocations#remove(int)}.
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java