Source:
<code>void createNewTasks() throws JsonProcessingException { <START> if (spec.isSuspended()) { <END> return; } taskGroups.entrySet() .stream() .filter(taskGroup -> taskGroup.getValue().tasks.size() < ioConfig.getReplicas()) .forEach(taskGroup -> verifyAndMergeCheckpoints(taskGroup.getValue())); for (Integer groupId : partitionGroups.keySet()) { if (!taskGroups.containsKey(groupId)) { log.info("Creating new task group [%d] for partitions %s", groupId, partitionGroups.get(groupId).keySet()); Optional<DateTime> minimumMessageTime = (ioConfig.getLateMessageRejectionPeriod().isPresent() ? Optional.of( DateTimes.nowUtc().minus(ioConfig.getLateMessageRejectionPeriod().get()) ) : Optional.absent()); Optional<DateTime> maximumMessageTime = (ioConfig.getEarlyMessageRejectionPeriod().isPresent() ? Optional.of( DateTimes.nowUtc().plus(ioConfig.getTaskDuration()).plus(ioConfig.getEarlyMessageRejectionPeriod().get()) ) : Optional.absent()); final TaskGroup taskGroup = new TaskGroup( groupId, generateStartingOffsetsForPartitionGroup(groupId), minimumMessageTime, maximumMessageTime ); taskGroups.put( groupId, taskGroup ); } } boolean createdTask = false; for (Map.Entry<Integer, TaskGroup> entry : taskGroups.entrySet()) { TaskGroup taskGroup = entry.getValue(); Integer groupId = entry.getKey(); if (ioConfig.getReplicas() > taskGroup.tasks.size()) { log.info( "Number of tasks [%d] does not match configured numReplicas [%d] in task group [%d], creating more tasks", taskGroup.tasks.size(), ioConfig.getReplicas(), groupId ); createKafkaTasksForGroup(groupId, ioConfig.getReplicas() - taskGroup.tasks.size()); createdTask = true; } } if (createdTask && firstRunTime.isBeforeNow()) { scheduledExec.schedule(buildRunTask(), 5000, TimeUnit.MILLISECONDS); } }</code><technical_language>Is this needed, createNewTasks() is called suspended</technical_language>

Target:
void createNewTasks() throws JsonProcessingException { taskGroups.entrySet() .stream() .filter(taskGroup -> taskGroup.getValue().tasks.size() < ioConfig.getReplicas()) .forEach(taskGroup -> verifyAndMergeCheckpoints(taskGroup.getValue())); for (Integer groupId : partitionGroups.keySet()) { if (!taskGroups.containsKey(groupId)) { log.info("Creating new task group [%d] for partitions %s", groupId, partitionGroups.get(groupId).keySet()); Optional<DateTime> minimumMessageTime = (ioConfig.getLateMessageRejectionPeriod().isPresent() ? Optional.of( DateTimes.nowUtc().minus(ioConfig.getLateMessageRejectionPeriod().get()) ) : Optional.absent()); Optional<DateTime> maximumMessageTime = (ioConfig.getEarlyMessageRejectionPeriod().isPresent() ? Optional.of( DateTimes.nowUtc().plus(ioConfig.getTaskDuration()).plus(ioConfig.getEarlyMessageRejectionPeriod().get()) ) : Optional.absent()); final TaskGroup taskGroup = new TaskGroup( groupId, generateStartingOffsetsForPartitionGroup(groupId), minimumMessageTime, maximumMessageTime ); taskGroups.put( groupId, taskGroup ); } } boolean createdTask = false; for (Map.Entry<Integer, TaskGroup> entry : taskGroups.entrySet()) { TaskGroup taskGroup = entry.getValue(); Integer groupId = entry.getKey(); if (ioConfig.getReplicas() > taskGroup.tasks.size()) { log.info( "Number of tasks [%d] does not match configured numReplicas [%d] in task group [%d], creating more tasks", taskGroup.tasks.size(), ioConfig.getReplicas(), groupId ); createKafkaTasksForGroup(groupId, ioConfig.getReplicas() - taskGroup.tasks.size()); createdTask = true; } } if (createdTask && firstRunTime.isBeforeNow()) { scheduledExec.schedule(buildRunTask(), 5000, TimeUnit.MILLISECONDS); } }