private boolean shouldEnqueue() {
      if (terminateCurrentContinuousReplicationCycle) {
        logger.trace("Thread name: {} not creating new groups as terminate cycle received {}", threadName,
            terminateCurrentContinuousReplicationCycle);
        return false;
      }
      int maxIterationsDoneByAnyGroup = dataNodeTrackers.stream()
          .map(DataNodeTracker::getMaxIterationAcrossGroups)
          .max(Comparator.naturalOrder())
          .orElse(0);
      if (maxIterationsDoneByAnyGroup >= continuousReplicationGroupIterationLimit) {
        logger.trace("Thread name: {} not creating new groups as iteration limit {} reached", threadName,
            maxIterationsDoneByAnyGroup);
        return false;
      }
      return true;
    }
Conditions when we don't want to create new groups.

1. terminateCurrentContinuousReplicationCycle is true, which means there are replicas added to this thread
   or removed from this thread, don't create new group and just let existing groups finish,
   so we can later create new groups with the new set of replicas in next cycle.
2. any group reaches max iteration, which means existing groups should just finish its current work and stop,
   thus no new groups should be created.
@return {@link boolean} returns true if new groups can be created, false otherwise
ambry-replication/src/main/java/com/github/ambry/replication/ReplicaThread.java