类 SimpleJobRepository
- java.lang.Object
- org.springframework.batch.core.repository.support.SimpleJobRepository
- 所有已实现的接口:
JobRepository
public class SimpleJobRepository extends java.lang.Object implements JobRepository
Implementation of
JobRepository
that stores JobInstances, JobExecutions, and StepExecutions using the injected DAOs.- 作者:
- Lucas Ward, Dave Syer, Robert Kasanicky, David Turanski, Mahmoud Ben Hassine
- 另请参阅:
JobRepository
,JobInstanceDao
,JobExecutionDao
,StepExecutionDao
构造器概要
构造器 构造器 说明 SimpleJobRepository(JobInstanceDao jobInstanceDao, JobExecutionDao jobExecutionDao, StepExecutionDao stepExecutionDao, ExecutionContextDao ecDao)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
add(StepExecution stepExecution)
Save theStepExecution
and itsExecutionContext
.void
addAll(java.util.Collection<StepExecution> stepExecutions)
Save a collection ofStepExecution
s and eachExecutionContext
.JobExecution
createJobExecution(java.lang.String jobName, JobParameters jobParameters)
JobExecution
createJobExecution(JobInstance jobInstance, JobParameters jobParameters, java.lang.String jobConfigurationLocation)
Create a newJobExecution
based upon theJobInstance
it's associated with, theJobParameters
used to execute it with and the location of the configuration file that defines the job.JobInstance
createJobInstance(java.lang.String jobName, JobParameters jobParameters)
Create a newJobInstance
with the name and job parameters provided.JobExecution
getLastJobExecution(java.lang.String jobName, JobParameters jobParameters)
StepExecution
getLastStepExecution(JobInstance jobInstance, java.lang.String stepName)
int
getStepExecutionCount(JobInstance jobInstance, java.lang.String stepName)
boolean
isJobInstanceExists(java.lang.String jobName, JobParameters jobParameters)
Check if an instance of this job already exists with the parameters provided.void
update(JobExecution jobExecution)
Update theJobExecution
(but not itsExecutionContext
).void
update(StepExecution stepExecution)
Update theStepExecution
(but not itsExecutionContext
).void
updateExecutionContext(JobExecution jobExecution)
Persist the updatedExecutionContext
of the givenJobExecution
.void
updateExecutionContext(StepExecution stepExecution)
Persist the updatedExecutionContext
s of the givenStepExecution
.
构造器详细资料
SimpleJobRepository
public SimpleJobRepository(JobInstanceDao jobInstanceDao, JobExecutionDao jobExecutionDao, StepExecutionDao stepExecutionDao, ExecutionContextDao ecDao)
方法详细资料
isJobInstanceExists
public boolean isJobInstanceExists(java.lang.String jobName, JobParameters jobParameters)
从接口复制的说明:JobRepository
Check if an instance of this job already exists with the parameters provided.- 指定者:
isJobInstanceExists
在接口中JobRepository
- 参数:
jobName
- the name of the jobjobParameters
- the parameters to match- 返回:
- true if a
JobInstance
already exists for this job name and job parameters
createJobExecution
public JobExecution createJobExecution(java.lang.String jobName, JobParameters jobParameters) throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException
从接口复制的说明:JobRepository
Create a
JobExecution
for a givenJob
andJobParameters
. If matchingJobInstance
already exists, the job must be restartable and it's last JobExecution must *not* be completed. If matchingJobInstance
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 sameJobParameters
and job name). The first transaction to complete in this scenario obtains a validJobExecution
, and others throwJobExecutionAlreadyRunningException
(or timeout). There are no such guarantees if theJobInstanceDao
andJobExecutionDao
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
在接口中JobRepository
- 参数:
jobName
- the name of the job that is to be executedjobParameters
- the runtime parameters for the job- 返回:
- a valid
JobExecution
for the arguments provided - 抛出:
JobExecutionAlreadyRunningException
- if there is aJobExecution
already running for the job instance with the provided job and parameters.JobRestartException
- if one or more existingJobInstance
s is found with the same parameters andJob.isRestartable()
is false.JobInstanceAlreadyCompleteException
- if aJobInstance
is found and was already completed successfully.
update
public void update(JobExecution jobExecution)
从接口复制的说明:JobRepository
Update theJobExecution
(but not itsExecutionContext
). Preconditions:JobExecution
must contain a validJobInstance
and be saved (have an id assigned).- 指定者:
update
在接口中JobRepository
- 参数:
jobExecution
-JobExecution
instance to be updated in the repo.
add
public void add(StepExecution stepExecution)
从接口复制的说明:JobRepository
Save theStepExecution
and itsExecutionContext
. 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 aJobRepository
. Preconditions:StepExecution
must have a validStep
.- 指定者:
add
在接口中JobRepository
- 参数:
stepExecution
-StepExecution
instance to be added to the repo.
addAll
public void addAll(java.util.Collection<StepExecution> stepExecutions)
从接口复制的说明:JobRepository
Save a collection ofStepExecution
s and eachExecutionContext
. The StepExecution 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 byJobRepository
. Preconditions:StepExecution
must have a validStep
.- 指定者:
addAll
在接口中JobRepository
- 参数:
stepExecutions
- collection ofStepExecution
instances to be added to the repo.
update
public void update(StepExecution stepExecution)
从接口复制的说明:JobRepository
Update theStepExecution
(but not itsExecutionContext
). Preconditions:StepExecution
must be saved (have an id assigned).- 指定者:
update
在接口中JobRepository
- 参数:
stepExecution
-StepExecution
instance to be updated in the repo.
updateExecutionContext
public void updateExecutionContext(StepExecution stepExecution)
从接口复制的说明:JobRepository
Persist the updatedExecutionContext
s of the givenStepExecution
.- 指定者:
updateExecutionContext
在接口中JobRepository
- 参数:
stepExecution
-StepExecution
instance to be used to update the context.
updateExecutionContext
public void updateExecutionContext(JobExecution jobExecution)
从接口复制的说明:JobRepository
Persist the updatedExecutionContext
of the givenJobExecution
.- 指定者:
updateExecutionContext
在接口中JobRepository
- 参数:
jobExecution
-JobExecution
instance to be used to update the context.
getLastStepExecution
@Nullable public StepExecution getLastStepExecution(JobInstance jobInstance, java.lang.String stepName)
- 指定者:
getLastStepExecution
在接口中JobRepository
- 参数:
jobInstance
-JobInstance
instance containing the step executions.stepName
- the name of the step execution that might have run.- 返回:
- the last execution of step for the given job instance.
getStepExecutionCount
public int getStepExecutionCount(JobInstance jobInstance, java.lang.String stepName)
- 指定者:
getStepExecutionCount
在接口中JobRepository
- 参数:
jobInstance
-JobInstance
instance containing the step executions.stepName
- the name of the step execution that might have run.- 返回:
- number of executions of the step within given job instance
getLastJobExecution
@Nullable public JobExecution getLastJobExecution(java.lang.String jobName, JobParameters jobParameters)
- 指定者:
getLastJobExecution
在接口中JobRepository
- 参数:
jobName
- the name of the job that might have runjobParameters
- parameters identifying theJobInstance
- 返回:
- the last execution of job if exists, null otherwise
createJobInstance
public JobInstance createJobInstance(java.lang.String jobName, JobParameters jobParameters)
从接口复制的说明:JobRepository
Create a newJobInstance
with the name and job parameters provided.- 指定者:
createJobInstance
在接口中JobRepository
- 参数:
jobName
- logical name of the jobjobParameters
- parameters used to execute the job- 返回:
- the new
JobInstance
createJobExecution
public JobExecution createJobExecution(JobInstance jobInstance, JobParameters jobParameters, java.lang.String jobConfigurationLocation)
从接口复制的说明:JobRepository
Create a newJobExecution
based upon theJobInstance
it's associated with, theJobParameters
used to execute it with and the location of the configuration file that defines the job.- 指定者:
createJobExecution
在接口中JobRepository
- 参数:
jobInstance
-JobInstance
instance to initialize the new JobExecution.jobParameters
-JobParameters
instance to initialize the new JobExecution.jobConfigurationLocation
-String
instance to initialize the new JobExecution.- 返回:
- the new
JobExecution
.