public JobExecution abandon(Long jobExecutionId) throws NoSuchJobExecutionException,
JobExecutionAlreadyRunningException {
JobExecution jobExecution = getJobExecution(jobExecutionId);
if (jobExecution.getStatus().isLessThan(BatchStatus.STOPPING)) {
throw new JobExecutionAlreadyRunningException(
"JobExecution is running or complete and therefore cannot be aborted");
}
logger.info("Aborting job execution: " + jobExecution);
jobExecution.upgradeStatus(BatchStatus.ABANDONED);