public void addLeaderPartition(String partitionName) {

      // Read-write lock avoids contention from threads removing old leader partitions (removePartition()) and
      // threads updating existing leader partitions (refreshPeerLeadersForAllPartitions())
      rwLockForLeaderReplicaUpdates.writeLock().lock();
      try {
        // Get the peer leader replicas from all data centers for this partition
        Set<ReplicaId> peerLeaderReplicas = getPeerLeaderReplicaSet(partitionName);
        logger.info("Adding leader Partition {} and list of peer leader replicas {} on node {} to an in-memory map",
            partitionName, peerLeaderReplicas, dataNodeId);
        leaderPartitionToPeerLeaderReplicas.put(partitionName, peerLeaderReplicas);
      } finally {
        rwLockForLeaderReplicaUpdates.writeLock().unlock();
      }
    }
Add a leader partition and its set of peer leader replicas. This method is thread safe.
@param partitionName name of the partition to be added
ambry-replication/src/main/java/com/github/ambry/replication/ReplicationEngine.java