@Override
  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "NP_NULL_ON_SOME_PATH",
      justification = "NPE should never happen; if it does it is a bigger issue")
  public void preCommitStoreFile(final ObserverContext<? extends RegionCoprocessorEnvironment> ctx,
    final byte[] family, final List<Pair<Path, Path>> pairs) throws IOException {
    RegionCoprocessorEnvironment env = ctx.getEnvironment();
    Configuration c = env.getConfiguration();
    if (
      pairs == null || pairs.isEmpty()
        || !c.getBoolean(HConstants.REPLICATION_BULKLOAD_ENABLE_KEY,
          HConstants.REPLICATION_BULKLOAD_ENABLE_DEFAULT)
    ) {
      LOG.debug("Skipping recording bulk load entries in preCommitStoreFile for bulkloaded "
        + "data replication.");
      return;
    }
    // This is completely cheating AND getting a HRegionServer from a RegionServerEnvironment is
    // just going to break. This is all private. Not allowed. Regions shouldn't assume they are
    // hosted in a RegionServer. TODO: fix.
    RegionServerServices rss = ((HasRegionServerServices) env).getRegionServerServices();
    Replication rep = (Replication) ((HRegionServer) rss).getReplicationSourceService();
    rep.addHFileRefsToQueue(env.getRegionInfo().getTable(), family, pairs);
  }
An Observer to add HFile References to replication queue.
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationObserver.java