@ManagedResource public class JobLauncherSynchronizer extends Object implements org.springframework.beans.factory.InitializingBean
JobLauncher
that synchronizes jobs globally so that
only one execution of a given Job can be active at once.Constructor and Description |
---|
JobLauncherSynchronizer() |
Modifier and Type | Method and Description |
---|---|
void |
addJobName(String jobName)
A job name that will be synchronized.
|
void |
afterPropertiesSet() |
void |
checkJobBeforeLaunch(org.springframework.batch.core.Job job) |
void |
checkJobDuringLaunch(String jobName,
org.springframework.batch.core.JobExecution jobExecution) |
Set<String> |
getJobNames() |
void |
removeJobName(String jobName)
Remove a job name from the list to synchronize.
|
void |
setJobExplorer(org.springframework.batch.core.explore.JobExplorer jobExplorer)
The
JobExplorer to use to inspect existing executions. |
void |
setJobNames(Set<String> jobNames)
Set of job names that will be synchronized.
|
void |
setJobRepository(org.springframework.batch.core.repository.JobRepository jobRepository)
The
JobRepository needed for updates to execution data. |
public void setJobExplorer(org.springframework.batch.core.explore.JobExplorer jobExplorer)
JobExplorer
to use to inspect existing executions.jobExplorer
- a JobExplorer
public void setJobRepository(org.springframework.batch.core.repository.JobRepository jobRepository)
JobRepository
needed for updates to execution data.jobRepository
- a JobRepository
public void setJobNames(Set<String> jobNames)
jobNames
- the job names@ManagedOperation public void addJobName(String jobName)
jobName
- the job name@ManagedOperation public void removeJobName(String jobName)
jobName
- the job namepublic void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public void checkJobBeforeLaunch(org.springframework.batch.core.Job job) throws org.springframework.batch.core.repository.JobExecutionAlreadyRunningException
org.springframework.batch.core.repository.JobExecutionAlreadyRunningException
public void checkJobDuringLaunch(String jobName, org.springframework.batch.core.JobExecution jobExecution) throws org.springframework.batch.core.repository.JobExecutionAlreadyRunningException
org.springframework.batch.core.repository.JobExecutionAlreadyRunningException
Copyright © 2015. All rights reserved.