public boolean isLeaderPair(ReplicaId localReplica, ReplicaId remoteReplica) {
      rwLockForLeaderReplicaUpdates.readLock().lock();
      try {
        String partitionName = localReplica.getPartitionId().toPathString();
        return leaderPartitionToPeerLeaderReplicas.getOrDefault(partitionName, Collections.emptySet())
            .contains(remoteReplica);
      } finally {
        rwLockForLeaderReplicaUpdates.readLock().unlock();
      }
    }
Checks if provided local and remote replicas are leaders of their partition. I.e. checks if partition corresponding
to local replica is a leader partition on local node (present in leaderPartitionToPeerLeaderReplicas map) and the leader
partition contains remote replica in its list of peer leader replicas.
For example: Say if the partition corresponding to provided local/remote replica is 100, and if local replica is
a leader of this partition, this map would have an entry {"100": List of remote leaders}. If remote replica is a
leader as well, it would be present in the entry value (list of remote leaders). In that case, we return true.
Else, we return false.
@param localReplica local replica
@param remoteReplica remote replica
@return true if local and remote replica are leaders of their partition.
ambry-replication/src/main/java/com/github/ambry/replication/ReplicationEngine.java