|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.core.job.AbstractJob
public abstract class AbstractJob
Batch domain object representing a job. Job is an explicit abstraction representing the configuration of a job specified by a developer. It should be noted that restart policy is applied to the job as a whole and not to a step.
| Field Summary | |
|---|---|
protected static Log |
logger
|
| Constructor Summary | |
|---|---|
AbstractJob()
Default constructor. |
|
AbstractJob(String name)
Convenience constructor to immediately add name (which is mandatory but not final). |
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
Assert mandatory properties: JobRepository. |
protected abstract StepExecution |
doExecute(JobExecution execution)
Extension point for subclasses allowing them to concentrate on processing logic and ignore listeners and repository calls. |
void |
execute(JobExecution execution)
Run the specified job, handling all listener and repository calls, and delegating the actual processing to doExecute(JobExecution). |
JobParametersIncrementer |
getJobParametersIncrementer()
If clients need to generate new parameters for the next execution in a sequence they can use this incrementer. |
String |
getName()
|
protected StepExecution |
handleStep(Step step,
JobExecution execution)
Convenience method for subclasses to delegate the handling of a specific step in the context of the current JobExecution. |
boolean |
isRestartable()
Flag to indicate if this job can be restarted, at least in principle. |
void |
registerJobExecutionListener(JobExecutionListener listener)
Register a single listener for the JobExecutionListener
callbacks. |
void |
setBeanName(String name)
Set the name property if it is not already set. |
void |
setJobExecutionListeners(JobExecutionListener[] listeners)
Public setter for injecting JobExecutionListeners. |
void |
setJobParametersIncrementer(JobParametersIncrementer jobParametersIncrementer)
Public setter for the JobParametersIncrementer. |
void |
setJobRepository(JobRepository jobRepository)
Public setter for the JobRepository that is needed to manage the
state of the batch meta domain (jobs, steps, executions) during the life
of a job. |
void |
setName(String name)
Set the name property. |
void |
setRestartable(boolean restartable)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final Log logger
| Constructor Detail |
|---|
public AbstractJob()
public AbstractJob(String name)
name - | Method Detail |
|---|
public void afterPropertiesSet()
throws Exception
JobRepository.
afterPropertiesSet in interface InitializingBeanExceptionInitializingBean.afterPropertiesSet()public void setBeanName(String name)
setBeanName in interface BeanNameAwareBeanNameAware.setBeanName(java.lang.String)public void setName(String name)
setBeanName(java.lang.String)public String getName()
getName in interface Jobpublic void setRestartable(boolean restartable)
public boolean isRestartable()
Job
isRestartable in interface JobJob.isRestartable()public void setJobParametersIncrementer(JobParametersIncrementer jobParametersIncrementer)
JobParametersIncrementer.
jobParametersIncrementer - the JobParametersIncrementer to
setpublic JobParametersIncrementer getJobParametersIncrementer()
Job
getJobParametersIncrementer in interface Jobpublic void setJobExecutionListeners(JobExecutionListener[] listeners)
JobExecutionListeners. They will all
be given the listener callbacks at the appropriate point in the job.
listeners - the listeners to set.public void registerJobExecutionListener(JobExecutionListener listener)
JobExecutionListener
callbacks.
listener - a JobExecutionListenerpublic void setJobRepository(JobRepository jobRepository)
JobRepository that is needed to manage the
state of the batch meta domain (jobs, steps, executions) during the life
of a job.
jobRepository -
protected abstract StepExecution doExecute(JobExecution execution)
throws JobExecutionException
handleStep(Step, JobExecution).
execution - the current JobExecution
StepExecution (used to compute the final status
of the JobExecution)
JobExecutionException - to signal a fatal batch framework error
(not a business or validation exception)public final void execute(JobExecution execution)
doExecute(JobExecution).
execute in interface Jobexecution - a JobExecution
StartLimitExceededException - if start limit of one of the steps
was exceededJob.execute(JobExecution)
protected final StepExecution handleStep(Step step,
JobExecution execution)
throws JobInterruptedException,
JobRestartException,
StartLimitExceededException
JobExecution. Clients of this
method do not need access to the JobRepository, nor do they need
to worry about populating the execution context on a restart, nor
detecting the interrupted state (in job or step execution).
step - the Step to executeexecution - the current JobExecution
StepExecution corresponding to this step
JobInterruptedException - if the JobExecution has been
interrupted, and in particular if BatchStatus.STOPPED or
BatchStatus.STOPPING is detected
StartLimitExceededException - if the start limit has been exceeded
for this step
JobRestartException - if the job is in an inconsistent state from
an earlier failurepublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||