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));
}
}
}
}