private void processCompletedPartitions() {
    for (PartitionId partitionId : currentlyReplicatingPriorityPartitions) {
      try {
        if (hasCompletedReplication(partitionId)) {
          completedPartitions.add(partitionId);
        }
      } catch (Exception e) {
        logger.error("Error checking replication status for partition {} {}", partitionId, e.getMessage());
      }
    }

    // Remove completed partitions from current set
    currentlyReplicatingPriorityPartitions.removeAll(completedPartitions);
    replicationPrioritizationMetrics.updateCurrentlyReplicatingPriorityPartitions(currentlyReplicatingPriorityPartitions);
    logger.info("Removed {} completed partitions from replication set", completedPartitions.size());

    if (currentlyReplicatingPriorityPartitions.isEmpty()) {
      logger.info("No currently replicating partitions, disabling high-priority replication");
      isHighPriorityReplicationRunning.set(false);
    }
    completedPartitions.clear();
  }
Process any partitions that have completed replication.
ambry-prioritization/src/main/java/com/github/ambry/replica/prioritization/ReplicationPrioritizationManager.java