protected PartitionId getPartitionForPut(String partitionClass, List<PartitionId> partitionIdsToExclude)
        throws RouterException {
      PartitionId selected = clusterMap.getRandomWritablePartition(partitionClass, partitionIdsToExclude);
      if (selected == null) {
        throw new RouterException("No writable partitions of class '" + partitionClass + "' or default available.",
            RouterErrorCode.AmbryUnavailable);
      }
      if (!partitionClass.equals(selected.getPartitionClass())) {
        logger.warn(
            "{}: No partitions for partitionClass='{}' found, partitionClass='{}' used instead. blobProperties={}",
            loggingContext, partitionClass, selected.getPartitionClass(), passedInBlobProperties);
        routerMetrics.unknownPartitionClassCount.inc();
      }
      return selected;
    }
Choose a random {@link PartitionId} for putting the current chunk and return it.
@param partitionClass the partition class to choose partitions from.
@param partitionIdsToExclude the list of {@link PartitionId}s that should be excluded from consideration.
@return the chosen {@link PartitionId}
@throws RouterException
ambry-router/src/main/java/com/github/ambry/router/PutOperation.java