Allow a job to pause itself and await further instructions. A paused status indicates to a user that the job is waiting, either for a manual signal to proceed, or for a remote worker to finish doing something asynchronously. For instance, a job may require manual verification of business condition before continuing - a sanity check on critical data. Assume that a job execution could receive hundreds of resume signals, and this is a "normal" situation, so it does not create a horrible mess in the history of the execution - e.g. looking like hundreds of restarts.
The vanilla successful case proceeds as follows:
public interface JobLauncher { public JobExecution run(Job job, JobParameters jobParameters) throws ....; }
In the case that the last execution failed, we already pick up from where we left off with a new JobExecution. The only difference now is that we don't need a new JobExecution, so we have to be careful about concurrency - what happens if two agents try to resume the job at once. To be safe we can treat this the same way as a restart - lock the JobExecution table in the database by setting a TX isolation attribute on the JobRepository.