@Override
  public void preOpen(ObserverContext<? extends RegionCoprocessorEnvironment> c) {
    int replicaId = c.getEnvironment().getRegion().getRegionInfo().getReplicaId();
    if (replicaId != RegionInfo.DEFAULT_REPLICA_ID) {
      while (slowDownReplicaOpen) {
        LOG.info("Slow down replica region open a bit");
        try {
          Thread.sleep(250);
        } catch (InterruptedException ignored) {
          return;
        }
      }
    }
  }
This coprocessor is used to slow down opening of the replica regions.
hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/RegionServerHostingReplicaSlowOpenCoprocessor.java