@Override
  public Entry filter(Entry entry) {
    // don't replicate if the log entries have already been consumed by the cluster
    if (
      replicationEndpoint.canReplicateToSameCluster()
        || !entry.getKey().getClusterIds().contains(peerClusterId)
    ) {
      WALEdit edit = entry.getEdit();
      WALKeyImpl logKey = (WALKeyImpl) entry.getKey();

      if (edit != null && !edit.isEmpty()) {
        // Mark that the current cluster has the change
        logKey.addClusterId(clusterId);
        return entry;
      }
    }
    return null;
  }
@param clusterId           id of this cluster
@param peerClusterId       of the other cluster
@param replicationEndpoint ReplicationEndpoint which will handle the actual replication
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ClusterMarkingEntryFilter.java