protected void removeRemoteReplicaInfoFromReplicaThread(List<RemoteReplicaInfo> remoteReplicaInfos) {
    for (RemoteReplicaInfo remoteReplicaInfo : remoteReplicaInfos) {
      // Thread safe with addRemoteReplicaInfoToReplicaThread.
      // For ReplicationManger, removeRemoteReplicaInfo() ensures lock is held by only one thread at any time.
      // For CloudBackUpManager with HelixVcrCluster, Helix requires acknowledgement before next message for the same
      // resource, which means methods in HelixVcrStateModel will be executed sequentially for same partition.
      // So do listener actions in addPartition() and removePartition().
      if (remoteReplicaInfo.getReplicaThread() != null) {
        remoteReplicaInfo.getReplicaThread().removeRemoteReplicaInfo(remoteReplicaInfo);
        remoteReplicaInfo.setReplicaThread(null);
      }
    }
  }
Remove a list of {@link RemoteReplicaInfo} from each's {@link ReplicaThread}.
@param remoteReplicaInfos List of {@link RemoteReplicaInfo} to remote.
ambry-replication/src/main/java/com/github/ambry/replication/ReplicationEngine.java