Search in sources :

Example 1 with NoSuchJobException

use of org.springframework.batch.core.launch.NoSuchJobException in project spring-boot by spring-projects.

the class JobLauncherCommandLineRunner method executeRegisteredJobs.

private void executeRegisteredJobs(JobParameters jobParameters) throws JobExecutionException {
    if (this.jobRegistry != null && StringUtils.hasText(this.jobNames)) {
        String[] jobsToRun = this.jobNames.split(",");
        for (String jobName : jobsToRun) {
            try {
                Job job = this.jobRegistry.getJob(jobName);
                if (this.jobs.contains(job)) {
                    continue;
                }
                execute(job, jobParameters);
            } catch (NoSuchJobException ex) {
                logger.debug("No job found in registry for job name: " + jobName);
                continue;
            }
        }
    }
}
Also used : NoSuchJobException(org.springframework.batch.core.launch.NoSuchJobException) Job(org.springframework.batch.core.Job)

Aggregations

Job (org.springframework.batch.core.Job)1 NoSuchJobException (org.springframework.batch.core.launch.NoSuchJobException)1