Source:
<code>public TerminationData killJobs(List<JobId> jobIds) { jobIds.forEach(jobId -> jlogger.info(jobId, "killing job")); List<JobData> jobDatas = lockJobs(jobIds); if (jobDatas == null) { <START> return null; END> } try { TaskResultImpl taskResult = null; JobStatus jobStatus = JobStatus.KILLED; Set<TaskId> tasksToUpdate = new HashSet<>(); TerminationData terminationData = TerminationData.newTerminationData(); for (JobData jobData : jobDatas) { JobId jobId = jobData.job.getId(); jobs.remove(jobId); terminationData.addJobToTerminate(jobId); InternalJob job = jobData.job; jlogger.info(job.getId(), "ending request"); for (Iterator<RunningTaskData> i = runningTasksData.values().iterator(); i.hasNext();) { RunningTaskData taskData = i.next(); if (taskData.getTask().getJobId().equals(jobId)) { i.remove(); taskData.getTask().setProgress(0); terminationData.addTaskData(job, taskData, TerminationData.TerminationStatus.ABORTED, taskResult); } } tasksToUpdate.addAll(job.failed(null, jobStatus)); } dbManager.killJobs(jobDatas.stream().map(jobData -> jobData.job).collect(Collectors.toList())); for (JobData jobData : jobDatas) { InternalJob job = jobData.job; updateTasksInSchedulerState(job, tasksToUpdate); SchedulerEvent event; if (job.getStatus() == JobStatus.PENDING) { event = SchedulerEvent.JOB_PENDING_TO_FINISHED; } else { event = SchedulerEvent.JOB_RUNNING_TO_FINISHED; } updateJobInSchedulerState(job, event); jlogger.info(job.getId(), "finished (" + jobStatus + ")"); jlogger.close(job.getId()); } return terminationData; } finally { jobDatas.forEach(JobData::unlock); } }</code><technical_language>I code todo merged master</technical_language>

Target:
public TerminationData killJobs(List<JobId> jobIds) { jobIds.forEach(jobId -> jlogger.info(jobId, "killing job")); List<JobData> jobDatas = lockJobs(jobIds); if (jobDatas == null || jobDatas.isEmpty()) { return TerminationData.EMPTY; } try { TaskResultImpl taskResult = null; JobStatus jobStatus = JobStatus.KILLED; Set<TaskId> tasksToUpdate = new HashSet<>(); TerminationData terminationData = TerminationData.newTerminationData(); for (JobData jobData : jobDatas) { JobId jobId = jobData.job.getId(); jobs.remove(jobId); terminationData.addJobToTerminate(jobId); InternalJob job = jobData.job; jlogger.info(job.getId(), "ending request"); for (Iterator<RunningTaskData> i = runningTasksData.values().iterator(); i.hasNext();) { RunningTaskData taskData = i.next(); if (taskData.getTask().getJobId().equals(jobId)) { i.remove(); taskData.getTask().setProgress(0); terminationData.addTaskData(job, taskData, TerminationData.TerminationStatus.ABORTED, taskResult); } } tasksToUpdate.addAll(job.failed(null, jobStatus)); } dbManager.killJobs(jobDatas.stream().map(jobData -> jobData.job).collect(Collectors.toList())); for (JobData jobData : jobDatas) { InternalJob job = jobData.job; updateTasksInSchedulerState(job, tasksToUpdate); SchedulerEvent event; if (job.getStatus() == JobStatus.PENDING) { event = SchedulerEvent.JOB_PENDING_TO_FINISHED; } else { event = SchedulerEvent.JOB_RUNNING_TO_FINISHED; } updateJobInSchedulerState(job, event); jlogger.info(job.getId(), "finished (" + jobStatus + ")"); jlogger.close(job.getId()); } return terminationData; } finally { jobDatas.forEach(JobData::unlock); } }