|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.core.repository.support.SimpleJobRepository
public class SimpleJobRepository
Implementation of JobRepository
that stores JobInstances,
JobExecutions, and StepExecutions using the injected DAOs.
JobRepository
,
JobInstanceDao
,
JobExecutionDao
,
StepExecutionDao
Constructor Summary | |
---|---|
SimpleJobRepository(JobInstanceDao jobInstanceDao,
JobExecutionDao jobExecutionDao,
StepExecutionDao stepExecutionDao,
ExecutionContextDao ecDao)
|
Method Summary | |
---|---|
void |
add(StepExecution stepExecution)
Save the StepExecution and its ExecutionContext . |
JobExecution |
createJobExecution(String jobName,
JobParameters jobParameters)
Create a JobExecution for a given Job and
JobParameters . |
JobExecution |
getLastJobExecution(String jobName,
JobParameters jobParameters)
|
StepExecution |
getLastStepExecution(JobInstance jobInstance,
String stepName)
|
int |
getStepExecutionCount(JobInstance jobInstance,
String stepName)
|
boolean |
isJobInstanceExists(String jobName,
JobParameters jobParameters)
Check if an instance of this job already exists with the parameters provided. |
void |
update(JobExecution jobExecution)
Update the JobExecution (but not its ExecutionContext ). |
void |
update(StepExecution stepExecution)
Update the StepExecution (but not its ExecutionContext ). |
void |
updateExecutionContext(JobExecution jobExecution)
Persist the updated ExecutionContext of the given
JobExecution . |
void |
updateExecutionContext(StepExecution stepExecution)
Persist the updated ExecutionContext s of the given
StepExecution . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleJobRepository(JobInstanceDao jobInstanceDao, JobExecutionDao jobExecutionDao, StepExecutionDao stepExecutionDao, ExecutionContextDao ecDao)
Method Detail |
---|
public boolean isJobInstanceExists(String jobName, JobParameters jobParameters)
JobRepository
isJobInstanceExists
in interface JobRepository
jobName
- the name of the jobjobParameters
- the parameters to match
JobInstance
already exists for this job name
and job parameterspublic JobExecution createJobExecution(String jobName, JobParameters jobParameters) throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException
JobRepository
Create a JobExecution
for a given Job
and
JobParameters
. If matching JobInstance
already exists,
the job must be restartable and it's last JobExecution must *not* be
completed. If matching JobInstance
does not exist yet it will be
created.
If this method is run in a transaction (as it normally would be) with
isolation level at Isolation.REPEATABLE_READ
or better, then this
method should block if another transaction is already executing it (for
the same JobParameters
and job name). The first transaction to
complete in this scenario obtains a valid JobExecution
, and
others throw JobExecutionAlreadyRunningException
(or timeout).
There are no such guarantees if the JobInstanceDao
and
JobExecutionDao
do not respect the transaction isolation levels
(e.g. if using a non-relational data-store, or if the platform does not
support the higher isolation levels).
createJobExecution
in interface JobRepository
jobName
- the name of the job that is to be executed jobParameters
- the runtime parameters for the job
JobExecution
for the arguments provided
JobExecutionAlreadyRunningException
- if there is a
JobExecution
already running for the job instance with the
provided job and parameters.
JobRestartException
- if one or more existing JobInstance
s
is found with the same parameters and Job.isRestartable()
is
false.
JobInstanceAlreadyCompleteException
- if a JobInstance
is
found and was already completed successfully.public void update(JobExecution jobExecution)
JobRepository
JobExecution
(but not its ExecutionContext
).
Preconditions: JobExecution
must contain a valid
JobInstance
and be saved (have an id assigned).
update
in interface JobRepository
public void add(StepExecution stepExecution)
JobRepository
StepExecution
and its ExecutionContext
. ID will
be assigned - it is not permitted that an ID be assigned before calling
this method. Instead, it should be left blank, to be assigned by a
JobRepository
.
Preconditions: StepExecution
must have a valid Step
.
add
in interface JobRepository
public void update(StepExecution stepExecution)
JobRepository
StepExecution
(but not its ExecutionContext
).
Preconditions: StepExecution
must be saved (have an id assigned).
update
in interface JobRepository
public void updateExecutionContext(StepExecution stepExecution)
JobRepository
ExecutionContext
s of the given
StepExecution
.
updateExecutionContext
in interface JobRepository
public void updateExecutionContext(JobExecution jobExecution)
JobRepository
ExecutionContext
of the given
JobExecution
.
updateExecutionContext
in interface JobRepository
public StepExecution getLastStepExecution(JobInstance jobInstance, String stepName)
getLastStepExecution
in interface JobRepository
stepName
- the name of the step execution that might have run.
public int getStepExecutionCount(JobInstance jobInstance, String stepName)
getStepExecutionCount
in interface JobRepository
stepName
- the name of the step execution that might have run.
public JobExecution getLastJobExecution(String jobName, JobParameters jobParameters)
getLastJobExecution
in interface JobRepository
jobName
- the name of the job that might have runjobParameters
- parameters identifying the JobInstance
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |