boolean addReplicaInfoIfAbsent(RemoteReplicaInfo remoteReplicaInfo) {
    rwLock.writeLock().lock();
    boolean isAdded = false;
    try {
      List<RemoteReplicaInfo> foundSameReplica = remoteReplicas.stream()
          .filter(info -> info.getReplicaId() == remoteReplicaInfo.getReplicaId())
          .collect(Collectors.toList());
      if (foundSameReplica.isEmpty()) {
        remoteReplicas.add(remoteReplicaInfo);
        isAdded = true;
      }
    } finally {
      rwLock.writeLock().unlock();
    }
    return isAdded;
  }
Add {@link RemoteReplicaInfo} to this {@link PartitionInfo} if it is previously absent.
@param remoteReplicaInfo the {@link RemoteReplicaInfo} to add.
@return {@code true} if remote replica info is added. {@code false} if it is already present
ambry-replication/src/main/java/com/github/ambry/replication/PartitionInfo.java