public class DefaultJobLoader extends java.lang.Object implements JobLoader, org.springframework.beans.factory.InitializingBean
JobLoader
. Uses a JobRegistry
to
manage a population of loaded jobs and clears them up when asked. An optional
StepRegistry
might also be set to register the step(s) available for
each registered job.Constructor and Description |
---|
DefaultJobLoader()
Default constructor useful for declarative configuration.
|
DefaultJobLoader(JobRegistry jobRegistry)
Creates a job loader with the job registry provided.
|
DefaultJobLoader(JobRegistry jobRegistry,
StepRegistry stepRegistry)
Creates a job loader with the job and step registries provided.
|
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
clear()
Unregister all the jobs and close all the contexts created by this
loader.
|
java.util.Collection<Job> |
load(ApplicationContextFactory factory)
Load an application context and register all the jobs.
|
java.util.Collection<Job> |
reload(ApplicationContextFactory factory)
Load an application context and register all the jobs, having first
unregistered them if already registered.
|
void |
setJobRegistry(JobRegistry jobRegistry)
The
JobRegistry to use for jobs created. |
void |
setStepRegistry(StepRegistry stepRegistry)
The
StepRegistry to use for the steps of created jobs. |
public DefaultJobLoader()
public DefaultJobLoader(JobRegistry jobRegistry)
jobRegistry
- a JobRegistry
public DefaultJobLoader(JobRegistry jobRegistry, @Nullable StepRegistry stepRegistry)
jobRegistry
- a JobRegistry
stepRegistry
- a StepRegistry
(can be null
)public void setJobRegistry(JobRegistry jobRegistry)
JobRegistry
to use for jobs created.jobRegistry
- the job registrypublic void setStepRegistry(StepRegistry stepRegistry)
StepRegistry
to use for the steps of created jobs.stepRegistry
- the step registrypublic void clear()
clear
in interface JobLoader
JobLoader.clear()
public java.util.Collection<Job> reload(ApplicationContextFactory factory)
JobLoader
public java.util.Collection<Job> load(ApplicationContextFactory factory) throws DuplicateJobException
JobLoader
load
in interface JobLoader
factory
- a factory for an application context (containing jobs)DuplicateJobException
- if a job with the same name was already
registeredpublic void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean