Class JdbcJobRepositoryService
- java.lang.Object
-
- org.wildfly.extension.batch.jberet.job.repository.JdbcJobRepositoryService
-
- All Implemented Interfaces:
org.jberet.repository.JobRepository,org.jboss.msc.Service,org.jboss.msc.service.Service<org.jberet.repository.JobRepository>,org.jboss.msc.value.Value<org.jberet.repository.JobRepository>
public class JdbcJobRepositoryService extends Object implements org.jboss.msc.service.Service<org.jberet.repository.JobRepository>
A service which provides a JDBC job repository.- Author:
- James R. Perkins, Richard Opalka
-
-
Constructor Summary
Constructors Constructor Description JdbcJobRepositoryService(Consumer<org.jberet.repository.JobRepository> jobRepositoryConsumer, Supplier<DataSource> dataSourceSupplier, Supplier<ExecutorService> executorSupplier, Integer executionRecordsLimit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddJob(org.jberet.repository.ApplicationAndJobName applicationAndJobName, org.jberet.job.model.Job job)voidaddPartitionExecution(org.jberet.runtime.StepExecutionImpl enclosingStepExecution, org.jberet.runtime.PartitionExecutionImpl partitionExecution)voidaddStepExecution(org.jberet.runtime.JobExecutionImpl jobExecution, org.jberet.runtime.StepExecutionImpl stepExecution)intcountStepStartTimes(String stepName, long jobInstanceId)org.jberet.runtime.JobExecutionImplcreateJobExecution(org.jberet.runtime.JobInstanceImpl jobInstance, Properties jobParameters)org.jberet.runtime.JobInstanceImplcreateJobInstance(org.jberet.job.model.Job job, String applicationName, ClassLoader classLoader)org.jberet.runtime.StepExecutionImplcreateStepExecution(String stepName)org.jberet.runtime.StepExecutionImplfindOriginalStepExecutionForRestart(String stepName, org.jberet.runtime.JobExecutionImpl jobExecutionToRestart, ClassLoader classLoader)protected org.jberet.repository.JobRepositorygetDelegate()org.jberet.job.model.JobgetJob(org.jberet.repository.ApplicationAndJobName applicationAndJobName)jakarta.batch.runtime.JobExecutiongetJobExecution(long jobExecutionId)List<jakarta.batch.runtime.JobExecution>getJobExecutions(jakarta.batch.runtime.JobInstance jobInstance)List<Long>getJobExecutionsByJob(String jobName)List<Long>getJobExecutionsByJob(String jobName, Integer executionRecordsLimit)jakarta.batch.runtime.JobInstancegetJobInstance(long jobInstanceId)intgetJobInstanceCount(String jobName)List<jakarta.batch.runtime.JobInstance>getJobInstances(String jobName)Set<String>getJobNames()List<org.jberet.runtime.PartitionExecutionImpl>getPartitionExecutions(long stepExecutionId, org.jberet.runtime.StepExecutionImpl stepExecution, boolean notCompletedOnly, ClassLoader classLoader)List<Long>getRunningExecutions(String jobName)List<jakarta.batch.runtime.StepExecution>getStepExecutions(long jobExecutionId, ClassLoader classLoader)org.jberet.repository.JobRepositorygetValue()booleanjobExists(String jobName)voidremoveJob(String jobId)voidremoveJobExecutions(org.jberet.repository.JobExecutionSelector jobExecutionSelector)voidremoveJobInstance(long jobInstanceId)voidsavePersistentData(jakarta.batch.runtime.JobExecution jobExecution, org.jberet.runtime.AbstractStepExecution stepOrPartitionExecution)intsavePersistentDataIfNotStopping(jakarta.batch.runtime.JobExecution jobExecution, org.jberet.runtime.AbstractStepExecution abstractStepExecution)voidstart(org.jboss.msc.service.StartContext context)voidstartJobRepository(org.jboss.msc.service.StartContext context)voidstop(org.jboss.msc.service.StopContext context)voidstopJobExecution(org.jberet.runtime.JobExecutionImpl jobExecution)voidstopJobRepository(org.jboss.msc.service.StopContext context)voidupdateJobExecution(org.jberet.runtime.JobExecutionImpl jobExecution, boolean fullUpdate, boolean saveJobParameters)voidupdateStepExecution(jakarta.batch.runtime.StepExecution stepExecution)
-
-
-
Constructor Detail
-
JdbcJobRepositoryService
public JdbcJobRepositoryService(Consumer<org.jberet.repository.JobRepository> jobRepositoryConsumer, Supplier<DataSource> dataSourceSupplier, Supplier<ExecutorService> executorSupplier, Integer executionRecordsLimit)
-
-
Method Detail
-
startJobRepository
public void startJobRepository(org.jboss.msc.service.StartContext context) throws org.jboss.msc.service.StartException- Throws:
org.jboss.msc.service.StartException
-
stopJobRepository
public void stopJobRepository(org.jboss.msc.service.StopContext context)
-
getDelegate
protected org.jberet.repository.JobRepository getDelegate()
-
start
public final void start(org.jboss.msc.service.StartContext context) throws org.jboss.msc.service.StartException- Specified by:
startin interfaceorg.jboss.msc.Service- Throws:
org.jboss.msc.service.StartException
-
stop
public final void stop(org.jboss.msc.service.StopContext context)
- Specified by:
stopin interfaceorg.jboss.msc.Service
-
getValue
public org.jberet.repository.JobRepository getValue() throws IllegalStateException, IllegalArgumentException- Specified by:
getValuein interfaceorg.jboss.msc.value.Value<org.jberet.repository.JobRepository>- Throws:
IllegalStateExceptionIllegalArgumentException
-
addJob
public void addJob(org.jberet.repository.ApplicationAndJobName applicationAndJobName, org.jberet.job.model.Job job)- Specified by:
addJobin interfaceorg.jberet.repository.JobRepository
-
removeJob
public void removeJob(String jobId)
- Specified by:
removeJobin interfaceorg.jberet.repository.JobRepository
-
getJob
public org.jberet.job.model.Job getJob(org.jberet.repository.ApplicationAndJobName applicationAndJobName)
- Specified by:
getJobin interfaceorg.jberet.repository.JobRepository
-
getJobNames
public Set<String> getJobNames()
- Specified by:
getJobNamesin interfaceorg.jberet.repository.JobRepository
-
jobExists
public boolean jobExists(String jobName)
WildFly JBeret subsystem validates a job name before each batch job operations. If a job name is invalid,
NoSuchJobExceptionwould already have been thrown. So this method is optimized to always return true.- Specified by:
jobExistsin interfaceorg.jberet.repository.JobRepository
-
createJobInstance
public org.jberet.runtime.JobInstanceImpl createJobInstance(org.jberet.job.model.Job job, String applicationName, ClassLoader classLoader)- Specified by:
createJobInstancein interfaceorg.jberet.repository.JobRepository
-
removeJobInstance
public void removeJobInstance(long jobInstanceId)
- Specified by:
removeJobInstancein interfaceorg.jberet.repository.JobRepository
-
getJobInstance
public jakarta.batch.runtime.JobInstance getJobInstance(long jobInstanceId)
- Specified by:
getJobInstancein interfaceorg.jberet.repository.JobRepository
-
getJobInstances
public List<jakarta.batch.runtime.JobInstance> getJobInstances(String jobName)
- Specified by:
getJobInstancesin interfaceorg.jberet.repository.JobRepository
-
getJobInstanceCount
public int getJobInstanceCount(String jobName)
- Specified by:
getJobInstanceCountin interfaceorg.jberet.repository.JobRepository
-
createJobExecution
public org.jberet.runtime.JobExecutionImpl createJobExecution(org.jberet.runtime.JobInstanceImpl jobInstance, Properties jobParameters)- Specified by:
createJobExecutionin interfaceorg.jberet.repository.JobRepository
-
getJobExecution
public jakarta.batch.runtime.JobExecution getJobExecution(long jobExecutionId)
- Specified by:
getJobExecutionin interfaceorg.jberet.repository.JobRepository
-
getJobExecutions
public List<jakarta.batch.runtime.JobExecution> getJobExecutions(jakarta.batch.runtime.JobInstance jobInstance)
- Specified by:
getJobExecutionsin interfaceorg.jberet.repository.JobRepository
-
updateJobExecution
public void updateJobExecution(org.jberet.runtime.JobExecutionImpl jobExecution, boolean fullUpdate, boolean saveJobParameters)- Specified by:
updateJobExecutionin interfaceorg.jberet.repository.JobRepository
-
stopJobExecution
public void stopJobExecution(org.jberet.runtime.JobExecutionImpl jobExecution)
- Specified by:
stopJobExecutionin interfaceorg.jberet.repository.JobRepository
-
getRunningExecutions
public List<Long> getRunningExecutions(String jobName)
- Specified by:
getRunningExecutionsin interfaceorg.jberet.repository.JobRepository
-
removeJobExecutions
public void removeJobExecutions(org.jberet.repository.JobExecutionSelector jobExecutionSelector)
- Specified by:
removeJobExecutionsin interfaceorg.jberet.repository.JobRepository
-
getStepExecutions
public List<jakarta.batch.runtime.StepExecution> getStepExecutions(long jobExecutionId, ClassLoader classLoader)
- Specified by:
getStepExecutionsin interfaceorg.jberet.repository.JobRepository
-
createStepExecution
public org.jberet.runtime.StepExecutionImpl createStepExecution(String stepName)
- Specified by:
createStepExecutionin interfaceorg.jberet.repository.JobRepository
-
addStepExecution
public void addStepExecution(org.jberet.runtime.JobExecutionImpl jobExecution, org.jberet.runtime.StepExecutionImpl stepExecution)- Specified by:
addStepExecutionin interfaceorg.jberet.repository.JobRepository
-
updateStepExecution
public void updateStepExecution(jakarta.batch.runtime.StepExecution stepExecution)
- Specified by:
updateStepExecutionin interfaceorg.jberet.repository.JobRepository
-
findOriginalStepExecutionForRestart
public org.jberet.runtime.StepExecutionImpl findOriginalStepExecutionForRestart(String stepName, org.jberet.runtime.JobExecutionImpl jobExecutionToRestart, ClassLoader classLoader)
- Specified by:
findOriginalStepExecutionForRestartin interfaceorg.jberet.repository.JobRepository
-
countStepStartTimes
public int countStepStartTimes(String stepName, long jobInstanceId)
- Specified by:
countStepStartTimesin interfaceorg.jberet.repository.JobRepository
-
addPartitionExecution
public void addPartitionExecution(org.jberet.runtime.StepExecutionImpl enclosingStepExecution, org.jberet.runtime.PartitionExecutionImpl partitionExecution)- Specified by:
addPartitionExecutionin interfaceorg.jberet.repository.JobRepository
-
getPartitionExecutions
public List<org.jberet.runtime.PartitionExecutionImpl> getPartitionExecutions(long stepExecutionId, org.jberet.runtime.StepExecutionImpl stepExecution, boolean notCompletedOnly, ClassLoader classLoader)
- Specified by:
getPartitionExecutionsin interfaceorg.jberet.repository.JobRepository
-
savePersistentData
public void savePersistentData(jakarta.batch.runtime.JobExecution jobExecution, org.jberet.runtime.AbstractStepExecution stepOrPartitionExecution)- Specified by:
savePersistentDatain interfaceorg.jberet.repository.JobRepository
-
savePersistentDataIfNotStopping
public int savePersistentDataIfNotStopping(jakarta.batch.runtime.JobExecution jobExecution, org.jberet.runtime.AbstractStepExecution abstractStepExecution)- Specified by:
savePersistentDataIfNotStoppingin interfaceorg.jberet.repository.JobRepository
-
getJobExecutionsByJob
public List<Long> getJobExecutionsByJob(String jobName)
- Specified by:
getJobExecutionsByJobin interfaceorg.jberet.repository.JobRepository
-
-