Summer.Batch.Core.Launch.Support.SimpleJobLauncher.HandleLastExecution C# (CSharp) Method

HandleLastExecution() private static method

Manage last job execution if required.
 
private static HandleLastExecution ( IJob job, JobExecution lastExecution ) : void
job IJob
lastExecution JobExecution
return void
        private static void HandleLastExecution(IJob job, JobExecution lastExecution)
        {
            //Last Execution handling
            if (lastExecution != null)
            {
                if (!job.Restartable)
                {
                    throw new JobRestartException("JobInstance already exists and is not restartable !");
                }
                foreach (StepExecution execution in lastExecution.StepExecutions)
                {
                    if (execution.BatchStatus == BatchStatus.Unknown)
                    {                      
                        throw new JobRestartException(string.Format("Step [{0}] is of status UNKNOWN", execution.StepName));
                    } 
                }
            }
        }