Class JobOperatorService
java.lang.Object
org.jberet.operations.AbstractJobOperator
org.wildfly.extension.batch.jberet.deployment.JobOperatorService
- All Implemented Interfaces:
jakarta.batch.operations.JobOperator,org.jboss.msc.Service,org.jboss.msc.service.Service<jakarta.batch.operations.JobOperator>,org.jboss.msc.value.Value<jakarta.batch.operations.JobOperator>
public class JobOperatorService
extends org.jberet.operations.AbstractJobOperator
implements jakarta.batch.operations.JobOperator, org.jboss.msc.service.Service<jakarta.batch.operations.JobOperator>
A delegating job operator to interact with the batch environment on
deployments.
Note that for each method the job name, or derived job name, must exist for the deployment. The allowed job names and job XML descriptor are determined at deployment time.
This implementation does change some of the API's contracts however it's only intended to be used by management resources and operations. Limits the interaction with the jobs to the scope of the deployments jobs. Any behavioral change will be documented.
- Author:
- James R. Perkins, Richard Opalka
-
Field Summary
Fields inherited from interface org.jboss.msc.service.Service
NULL -
Constructor Summary
ConstructorsConstructorDescriptionJobOperatorService(Consumer<jakarta.batch.operations.JobOperator> jobOperatorConsumer, Supplier<BatchConfiguration> batchConfigurationSupplier, Supplier<SecurityAwareBatchEnvironment> batchEnvironmentSupplier, Supplier<ExecutorService> executorSupplier, Supplier<org.jboss.as.server.suspend.SuspendController> suspendControllerSupplier, Supplier<org.jboss.as.controller.ProcessStateNotifier> processStateSupplier, Boolean restartJobsOnResume, String deploymentName, WildFlyJobXmlResolver resolver) -
Method Summary
Modifier and TypeMethodDescriptionvoidabandon(long executionId) default <T> TallowMissingJob(Supplier<T> supplier, T defaultValue) Allows safe execution of a method catching anyNoSuchJobExceptionthrown.jakarta.batch.runtime.JobExecutiongetJobExecution(long executionId) List<jakarta.batch.runtime.JobExecution>getJobExecutions(jakarta.batch.runtime.JobInstance instance) getJobExecutionsByJob(String jobName) jakarta.batch.runtime.JobInstancegetJobInstance(long executionId) intgetJobInstanceCount(String jobName) List<jakarta.batch.runtime.JobInstance>getJobInstances(String jobName, int start, int count) getJobXmlNames(String jobName) getParameters(long executionId) getRunningExecutions(String jobName) List<jakarta.batch.runtime.StepExecution>getStepExecutions(long jobExecutionId) jakarta.batch.operations.JobOperatorgetValue()longrestart(long executionId, Properties restartParameters) longstart(String jobXMLName, Properties jobParameters) voidstart(org.jboss.msc.service.StartContext context) voidstop(long executionId) voidstop(org.jboss.msc.service.StopContext context) Methods inherited from class org.jberet.operations.AbstractJobOperator
getJobExecutionImpl, getJobRepository, restart, start, start, start
-
Constructor Details
-
JobOperatorService
public JobOperatorService(Consumer<jakarta.batch.operations.JobOperator> jobOperatorConsumer, Supplier<BatchConfiguration> batchConfigurationSupplier, Supplier<SecurityAwareBatchEnvironment> batchEnvironmentSupplier, Supplier<ExecutorService> executorSupplier, Supplier<org.jboss.as.server.suspend.SuspendController> suspendControllerSupplier, Supplier<org.jboss.as.controller.ProcessStateNotifier> processStateSupplier, Boolean restartJobsOnResume, String deploymentName, WildFlyJobXmlResolver resolver)
-
-
Method Details
-
start
public 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 void stop(org.jboss.msc.service.StopContext context) - Specified by:
stopin interfaceorg.jboss.msc.Service
-
getValue
public jakarta.batch.operations.JobOperator getValue() throws IllegalStateException, IllegalArgumentException- Specified by:
getValuein interfaceorg.jboss.msc.value.Value<jakarta.batch.operations.JobOperator>- Throws:
IllegalStateExceptionIllegalArgumentException
-
getBatchEnvironment
- Specified by:
getBatchEnvironmentin classorg.jberet.operations.AbstractJobOperator
-
getJobNames
- Specified by:
getJobNamesin interfacejakarta.batch.operations.JobOperator- Overrides:
getJobNamesin classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.JobSecurityException
-
getJobInstanceCount
public int getJobInstanceCount(String jobName) throws jakarta.batch.operations.NoSuchJobException, jakarta.batch.operations.JobSecurityException - Specified by:
getJobInstanceCountin interfacejakarta.batch.operations.JobOperator- Overrides:
getJobInstanceCountin classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.NoSuchJobExceptionjakarta.batch.operations.JobSecurityException
-
getJobInstances
public List<jakarta.batch.runtime.JobInstance> getJobInstances(String jobName, int start, int count) throws jakarta.batch.operations.NoSuchJobException, jakarta.batch.operations.JobSecurityException - Specified by:
getJobInstancesin interfacejakarta.batch.operations.JobOperator- Overrides:
getJobInstancesin classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.NoSuchJobExceptionjakarta.batch.operations.JobSecurityException
-
getRunningExecutions
public List<Long> getRunningExecutions(String jobName) throws jakarta.batch.operations.NoSuchJobException, jakarta.batch.operations.JobSecurityException - Specified by:
getRunningExecutionsin interfacejakarta.batch.operations.JobOperator- Overrides:
getRunningExecutionsin classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.NoSuchJobExceptionjakarta.batch.operations.JobSecurityException
-
getJobExecutionsByJob
- Overrides:
getJobExecutionsByJobin classorg.jberet.operations.AbstractJobOperator
-
getParameters
public Properties getParameters(long executionId) throws jakarta.batch.operations.NoSuchJobExecutionException, jakarta.batch.operations.JobSecurityException - Specified by:
getParametersin interfacejakarta.batch.operations.JobOperator- Overrides:
getParametersin classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.NoSuchJobExecutionExceptionjakarta.batch.operations.JobSecurityException
-
start
public long start(String jobXMLName, Properties jobParameters) throws jakarta.batch.operations.JobStartException, jakarta.batch.operations.JobSecurityException - Specified by:
startin interfacejakarta.batch.operations.JobOperator- Overrides:
startin classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.JobStartExceptionjakarta.batch.operations.JobSecurityException
-
restart
public long restart(long executionId, Properties restartParameters) throws jakarta.batch.operations.JobExecutionAlreadyCompleteException, jakarta.batch.operations.NoSuchJobExecutionException, jakarta.batch.operations.JobExecutionNotMostRecentException, jakarta.batch.operations.JobRestartException, jakarta.batch.operations.JobSecurityException - Specified by:
restartin interfacejakarta.batch.operations.JobOperator- Overrides:
restartin classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.JobExecutionAlreadyCompleteExceptionjakarta.batch.operations.NoSuchJobExecutionExceptionjakarta.batch.operations.JobExecutionNotMostRecentExceptionjakarta.batch.operations.JobRestartExceptionjakarta.batch.operations.JobSecurityException
-
stop
public void stop(long executionId) throws jakarta.batch.operations.NoSuchJobExecutionException, jakarta.batch.operations.JobExecutionNotRunningException, jakarta.batch.operations.JobSecurityException - Specified by:
stopin interfacejakarta.batch.operations.JobOperator- Overrides:
stopin classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.NoSuchJobExecutionExceptionjakarta.batch.operations.JobExecutionNotRunningExceptionjakarta.batch.operations.JobSecurityException
-
abandon
public void abandon(long executionId) throws jakarta.batch.operations.NoSuchJobExecutionException, jakarta.batch.operations.JobExecutionIsRunningException, jakarta.batch.operations.JobSecurityException - Specified by:
abandonin interfacejakarta.batch.operations.JobOperator- Overrides:
abandonin classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.NoSuchJobExecutionExceptionjakarta.batch.operations.JobExecutionIsRunningExceptionjakarta.batch.operations.JobSecurityException
-
getJobInstance
public jakarta.batch.runtime.JobInstance getJobInstance(long executionId) throws jakarta.batch.operations.NoSuchJobExecutionException, jakarta.batch.operations.JobSecurityException - Specified by:
getJobInstancein interfacejakarta.batch.operations.JobOperator- Overrides:
getJobInstancein classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.NoSuchJobExecutionExceptionjakarta.batch.operations.JobSecurityException
-
getJobExecutions
public List<jakarta.batch.runtime.JobExecution> getJobExecutions(jakarta.batch.runtime.JobInstance instance) throws jakarta.batch.operations.NoSuchJobInstanceException, jakarta.batch.operations.JobSecurityException - Specified by:
getJobExecutionsin interfacejakarta.batch.operations.JobOperator- Overrides:
getJobExecutionsin classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.NoSuchJobInstanceExceptionjakarta.batch.operations.JobSecurityException
-
getJobExecution
public jakarta.batch.runtime.JobExecution getJobExecution(long executionId) throws jakarta.batch.operations.NoSuchJobExecutionException, jakarta.batch.operations.JobSecurityException - Specified by:
getJobExecutionin interfacejakarta.batch.operations.JobOperator- Overrides:
getJobExecutionin classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.NoSuchJobExecutionExceptionjakarta.batch.operations.JobSecurityException
-
getStepExecutions
public List<jakarta.batch.runtime.StepExecution> getStepExecutions(long jobExecutionId) throws jakarta.batch.operations.NoSuchJobExecutionException, jakarta.batch.operations.JobSecurityException - Specified by:
getStepExecutionsin interfacejakarta.batch.operations.JobOperator- Overrides:
getStepExecutionsin classorg.jberet.operations.AbstractJobOperator- Throws:
jakarta.batch.operations.NoSuchJobExecutionExceptionjakarta.batch.operations.JobSecurityException
-
getJobXmlNames
-
getJobXmlNames
-
getAllJobNames
-
allowMissingJob
Allows safe execution of a method catching anyNoSuchJobExceptionthrown. If the exception is thrown the default value is returned, otherwise the value from the supplier is returned.- Type Parameters:
T- the return type- Parameters:
supplier- the supplier for the valuedefaultValue- the default value if aNoSuchJobExceptionis thrown- Returns:
- the value from the supplier or the default value if a
NoSuchJobExceptionwas thrown
-