Source:
<code>public Boolean call() { boolean allJobsWereRemoved; try { long start = 0; if (logger.isInfoEnabled()) { start = System.currentTimeMillis(); logger.info("Removing jobs " + jobIds.stream().map(JobId::value).collect(Collectors.joining(", "))); } SchedulerDBManager dbManager = service.getInfrastructure().getDBManager(); <START> List<InternalJob> jobs = dbManager.loadJobWithTasksIfNotRemoved(jobIds.toArray(new JobId[0])); <END> if (jobs.size() != jobIds.size()) { for (JobId jobId : jobIds) { service.submitTerminationDataHandler(service.getJobs().removeJob(jobId)); } allJobsWereRemoved = false; } else { long removedTime = System.currentTimeMillis(); for (InternalJob job : jobs) { if (isInFinishedState(job)) { service.submitTerminationDataHandler(service.getJobs().removeJob(job.getId())); } else { service.submitTerminationDataHandler(service.getJobs().killJob(job.getId())); } job.setRemovedTime(removedTime); } boolean removeFromDb = PASchedulerProperties.JOB_REMOVE_FROM_DB.getValueAsBoolean(); dbManager.removeJob(jobIds, removedTime, removeFromDb); for (InternalJob job : jobs) { ServerJobAndTaskLogs.getInstance().remove(job.getId(), job.getOwner()); if (logger.isInfoEnabled()) { logger.info("Job " + job.getId() + " removed in " + (System.currentTimeMillis() - start) + "ms"); } service.getListener() .jobStateUpdated(job.getOwner(), new NotificationData<>(SchedulerEvent.JOB_REMOVE_FINISHED, new JobInfoImpl((JobInfoImpl) job.getJobInfo()))); } allJobsWereRemoved = true; } service.wakeUpSchedulingThread(); } catch (Exception e) { logger.error("Error while removing list of jobs " + jobIds.stream().map(JobId::value).collect(Collectors.joining(", ")), e); throw e; } return allJobsWereRemoved; }</code><technical_language>Call paranoid, JobId length check well</technical_language>

Target:
public Boolean call() { boolean allJobsWereRemoved; try { long start = 0; if (jobIds.isEmpty()) { logger.info("No jobs to remove. You should not create JobRemoveHandler with empty list of ids."); return false; } if (logger.isInfoEnabled()) { start = System.currentTimeMillis(); logger.info("Removing jobs " + jobIds.stream().map(JobId::value).collect(Collectors.joining(", "))); } SchedulerDBManager dbManager = service.getInfrastructure().getDBManager(); List<InternalJob> jobs = dbManager.loadJobWithTasksIfNotRemoved(jobIds.toArray(new JobId[0])); if (jobs.size() != jobIds.size()) { for (JobId jobId : jobIds) { service.submitTerminationDataHandler(service.getJobs().removeJob(jobId)); } allJobsWereRemoved = false; } else { long removedTime = System.currentTimeMillis(); for (InternalJob job : jobs) { if (isInFinishedState(job)) { service.submitTerminationDataHandler(service.getJobs().removeJob(job.getId())); } else { service.submitTerminationDataHandler(service.getJobs().killJob(job.getId())); } job.setRemovedTime(removedTime); } boolean removeFromDb = PASchedulerProperties.JOB_REMOVE_FROM_DB.getValueAsBoolean(); dbManager.removeJob(jobIds, removedTime, removeFromDb); for (InternalJob job : jobs) { ServerJobAndTaskLogs.getInstance().remove(job.getId(), job.getOwner()); if (logger.isInfoEnabled()) { logger.info("Job " + job.getId() + " removed in " + (System.currentTimeMillis() - start) + "ms"); } service.getListener() .jobStateUpdated(job.getOwner(), new NotificationData<>(SchedulerEvent.JOB_REMOVE_FINISHED, new JobInfoImpl((JobInfoImpl) job.getJobInfo()))); } allJobsWereRemoved = true; } service.wakeUpSchedulingThread(); } catch (Exception e) { logger.error("Error while removing list of jobs (" + jobIds.stream().map(JobId::value).collect(Collectors.joining(", ")) + ") due to : " + e.getMessage(), e); throw e; } return allJobsWereRemoved; }