Class InMemoryJobRepositoryService

  • 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 InMemoryJobRepositoryService
    extends Object
    implements org.jboss.msc.service.Service<org.jberet.repository.JobRepository>
    A service which provides an in-memory job repository.
    Author:
    James R. Perkins, Richard Opalka
    • Constructor Detail

      • InMemoryJobRepositoryService

        public InMemoryJobRepositoryService​(Consumer<org.jberet.repository.JobRepository> jobRepositoryConsumer,
                                            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:
        start in interface org.jboss.msc.Service
        Throws:
        org.jboss.msc.service.StartException
      • stop

        public final void stop​(org.jboss.msc.service.StopContext context)
        Specified by:
        stop in interface org.jboss.msc.Service
      • addJob

        public void addJob​(org.jberet.repository.ApplicationAndJobName applicationAndJobName,
                           org.jberet.job.model.Job job)
        Specified by:
        addJob in interface org.jberet.repository.JobRepository
      • removeJob

        public void removeJob​(String jobId)
        Specified by:
        removeJob in interface org.jberet.repository.JobRepository
      • getJob

        public org.jberet.job.model.Job getJob​(org.jberet.repository.ApplicationAndJobName applicationAndJobName)
        Specified by:
        getJob in interface org.jberet.repository.JobRepository
      • getJobNames

        public Set<String> getJobNames()
        Specified by:
        getJobNames in interface org.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, NoSuchJobException would already have been thrown. So this method is optimized to always return true.

        Specified by:
        jobExists in interface org.jberet.repository.JobRepository
      • createJobInstance

        public org.jberet.runtime.JobInstanceImpl createJobInstance​(org.jberet.job.model.Job job,
                                                                    String applicationName,
                                                                    ClassLoader classLoader)
        Specified by:
        createJobInstance in interface org.jberet.repository.JobRepository
      • removeJobInstance

        public void removeJobInstance​(long jobInstanceId)
        Specified by:
        removeJobInstance in interface org.jberet.repository.JobRepository
      • getJobInstance

        public jakarta.batch.runtime.JobInstance getJobInstance​(long jobInstanceId)
        Specified by:
        getJobInstance in interface org.jberet.repository.JobRepository
      • getJobInstances

        public List<jakarta.batch.runtime.JobInstance> getJobInstances​(String jobName)
        Specified by:
        getJobInstances in interface org.jberet.repository.JobRepository
      • getJobInstanceCount

        public int getJobInstanceCount​(String jobName)
        Specified by:
        getJobInstanceCount in interface org.jberet.repository.JobRepository
      • createJobExecution

        public org.jberet.runtime.JobExecutionImpl createJobExecution​(org.jberet.runtime.JobInstanceImpl jobInstance,
                                                                      Properties jobParameters)
        Specified by:
        createJobExecution in interface org.jberet.repository.JobRepository
      • getJobExecution

        public jakarta.batch.runtime.JobExecution getJobExecution​(long jobExecutionId)
        Specified by:
        getJobExecution in interface org.jberet.repository.JobRepository
      • getJobExecutions

        public List<jakarta.batch.runtime.JobExecution> getJobExecutions​(jakarta.batch.runtime.JobInstance jobInstance)
        Specified by:
        getJobExecutions in interface org.jberet.repository.JobRepository
      • updateJobExecution

        public void updateJobExecution​(org.jberet.runtime.JobExecutionImpl jobExecution,
                                       boolean fullUpdate,
                                       boolean saveJobParameters)
        Specified by:
        updateJobExecution in interface org.jberet.repository.JobRepository
      • stopJobExecution

        public void stopJobExecution​(org.jberet.runtime.JobExecutionImpl jobExecution)
        Specified by:
        stopJobExecution in interface org.jberet.repository.JobRepository
      • getRunningExecutions

        public List<Long> getRunningExecutions​(String jobName)
        Specified by:
        getRunningExecutions in interface org.jberet.repository.JobRepository
      • removeJobExecutions

        public void removeJobExecutions​(org.jberet.repository.JobExecutionSelector jobExecutionSelector)
        Specified by:
        removeJobExecutions in interface org.jberet.repository.JobRepository
      • getStepExecutions

        public List<jakarta.batch.runtime.StepExecution> getStepExecutions​(long jobExecutionId,
                                                                           ClassLoader classLoader)
        Specified by:
        getStepExecutions in interface org.jberet.repository.JobRepository
      • createStepExecution

        public org.jberet.runtime.StepExecutionImpl createStepExecution​(String stepName)
        Specified by:
        createStepExecution in interface org.jberet.repository.JobRepository
      • addStepExecution

        public void addStepExecution​(org.jberet.runtime.JobExecutionImpl jobExecution,
                                     org.jberet.runtime.StepExecutionImpl stepExecution)
        Specified by:
        addStepExecution in interface org.jberet.repository.JobRepository
      • updateStepExecution

        public void updateStepExecution​(jakarta.batch.runtime.StepExecution stepExecution)
        Specified by:
        updateStepExecution in interface org.jberet.repository.JobRepository
      • findOriginalStepExecutionForRestart

        public org.jberet.runtime.StepExecutionImpl findOriginalStepExecutionForRestart​(String stepName,
                                                                                        org.jberet.runtime.JobExecutionImpl jobExecutionToRestart,
                                                                                        ClassLoader classLoader)
        Specified by:
        findOriginalStepExecutionForRestart in interface org.jberet.repository.JobRepository
      • countStepStartTimes

        public int countStepStartTimes​(String stepName,
                                       long jobInstanceId)
        Specified by:
        countStepStartTimes in interface org.jberet.repository.JobRepository
      • addPartitionExecution

        public void addPartitionExecution​(org.jberet.runtime.StepExecutionImpl enclosingStepExecution,
                                          org.jberet.runtime.PartitionExecutionImpl partitionExecution)
        Specified by:
        addPartitionExecution in interface org.jberet.repository.JobRepository
      • getPartitionExecutions

        public List<org.jberet.runtime.PartitionExecutionImpl> getPartitionExecutions​(long stepExecutionId,
                                                                                      org.jberet.runtime.StepExecutionImpl stepExecution,
                                                                                      boolean notCompletedOnly,
                                                                                      ClassLoader classLoader)
        Specified by:
        getPartitionExecutions in interface org.jberet.repository.JobRepository
      • savePersistentData

        public void savePersistentData​(jakarta.batch.runtime.JobExecution jobExecution,
                                       org.jberet.runtime.AbstractStepExecution stepOrPartitionExecution)
        Specified by:
        savePersistentData in interface org.jberet.repository.JobRepository
      • savePersistentDataIfNotStopping

        public int savePersistentDataIfNotStopping​(jakarta.batch.runtime.JobExecution jobExecution,
                                                   org.jberet.runtime.AbstractStepExecution abstractStepExecution)
        Specified by:
        savePersistentDataIfNotStopping in interface org.jberet.repository.JobRepository
      • getJobExecutionsByJob

        public List<Long> getJobExecutionsByJob​(String jobName)
        Specified by:
        getJobExecutionsByJob in interface org.jberet.repository.JobRepository
      • getJobExecutionsByJob

        public List<Long> getJobExecutionsByJob​(String jobName,
                                                Integer executionRecordsLimit)
        Specified by:
        getJobExecutionsByJob in interface org.jberet.repository.JobRepository