@Override
@Transactional(rollbackFor = GenieException.class)
public JobStatus finalizeJob(final String id, final int exitCode) throws GenieException {
final Job job = this.jobRepo.findOne(id);
if (job == null) {
throw new GenieNotFoundException("No job with id " + id + " exists");
}
job.setExitCode(exitCode);
// We check if status code is killed. The kill thread sets this, but just to make sure we set
// it here again to prevent a race condition problem. This just makes the status message as