public class JobOperatorService
extends org.jberet.operations.AbstractJobOperator
implements javax.batch.operations.JobOperator, org.jboss.msc.service.Service<javax.batch.operations.JobOperator>
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.
| Constructor and Description |
|---|
JobOperatorService(Boolean restartJobsOnResume,
String deploymentName,
WildFlyJobXmlResolver resolver) |
| Modifier and Type | Method and Description |
|---|---|
void |
abandon(long executionId) |
default <T> T |
allowMissingJob(Supplier<T> supplier,
T defaultValue)
Allows safe execution of a method catching any
NoSuchJobException thrown. |
Set<String> |
getAllJobNames()
Returns all the jobs this operator has access to.
|
org.jboss.msc.value.InjectedValue<BatchConfiguration> |
getBatchConfigurationInjector() |
protected SecurityAwareBatchEnvironment |
getBatchEnvironment() |
org.jboss.msc.inject.Injector<SecurityAwareBatchEnvironment> |
getBatchEnvironmentInjector()
Set the batch environment to use for setting up the correct class loader for delegating executions.
|
org.jboss.msc.inject.Injector<ExecutorService> |
getExecutorServiceInjector() |
javax.batch.runtime.JobExecution |
getJobExecution(long executionId) |
List<javax.batch.runtime.JobExecution> |
getJobExecutions(javax.batch.runtime.JobInstance instance) |
javax.batch.runtime.JobInstance |
getJobInstance(long executionId) |
int |
getJobInstanceCount(String jobName) |
List<javax.batch.runtime.JobInstance> |
getJobInstances(String jobName,
int start,
int count) |
Set<String> |
getJobNames() |
Collection<String> |
getJobXmlNames()
Returns all the job XML descriptors associated with this deployment.
|
Collection<String> |
getJobXmlNames(String jobName)
Returns the job XML descriptors associated with a job.
|
Properties |
getParameters(long executionId) |
List<Long> |
getRunningExecutions(String jobName) |
List<javax.batch.runtime.StepExecution> |
getStepExecutions(long jobExecutionId) |
org.jboss.msc.value.InjectedValue<org.jboss.as.server.suspend.SuspendController> |
getSuspendControllerInjector() |
javax.batch.operations.JobOperator |
getValue() |
long |
restart(long executionId,
Properties restartParameters) |
void |
start(org.jboss.msc.service.StartContext context) |
long |
start(String jobXMLName,
Properties jobParameters) |
void |
stop(long executionId) |
void |
stop(org.jboss.msc.service.StopContext context) |
public JobOperatorService(Boolean restartJobsOnResume, String deploymentName, WildFlyJobXmlResolver resolver)
public void start(org.jboss.msc.service.StartContext context)
throws org.jboss.msc.service.StartException
start in interface org.jboss.msc.service.Service<javax.batch.operations.JobOperator>org.jboss.msc.service.StartExceptionpublic void stop(org.jboss.msc.service.StopContext context)
stop in interface org.jboss.msc.service.Service<javax.batch.operations.JobOperator>public javax.batch.operations.JobOperator getValue()
throws IllegalStateException,
IllegalArgumentException
getValue in interface org.jboss.msc.value.Value<javax.batch.operations.JobOperator>IllegalStateExceptionIllegalArgumentExceptionprotected SecurityAwareBatchEnvironment getBatchEnvironment()
getBatchEnvironment in class org.jberet.operations.AbstractJobOperatorpublic Set<String> getJobNames() throws javax.batch.operations.JobSecurityException
getJobNames in interface javax.batch.operations.JobOperatorgetJobNames in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.JobSecurityExceptionpublic int getJobInstanceCount(String jobName) throws javax.batch.operations.NoSuchJobException, javax.batch.operations.JobSecurityException
getJobInstanceCount in interface javax.batch.operations.JobOperatorgetJobInstanceCount in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.NoSuchJobExceptionjavax.batch.operations.JobSecurityExceptionpublic List<javax.batch.runtime.JobInstance> getJobInstances(String jobName, int start, int count) throws javax.batch.operations.NoSuchJobException, javax.batch.operations.JobSecurityException
getJobInstances in interface javax.batch.operations.JobOperatorgetJobInstances in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.NoSuchJobExceptionjavax.batch.operations.JobSecurityExceptionpublic List<Long> getRunningExecutions(String jobName) throws javax.batch.operations.NoSuchJobException, javax.batch.operations.JobSecurityException
getRunningExecutions in interface javax.batch.operations.JobOperatorgetRunningExecutions in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.NoSuchJobExceptionjavax.batch.operations.JobSecurityExceptionpublic Properties getParameters(long executionId) throws javax.batch.operations.NoSuchJobExecutionException, javax.batch.operations.JobSecurityException
getParameters in interface javax.batch.operations.JobOperatorgetParameters in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.NoSuchJobExecutionExceptionjavax.batch.operations.JobSecurityExceptionpublic long start(String jobXMLName, Properties jobParameters) throws javax.batch.operations.JobStartException, javax.batch.operations.JobSecurityException
start in interface javax.batch.operations.JobOperatorstart in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.JobStartExceptionjavax.batch.operations.JobSecurityExceptionpublic long restart(long executionId,
Properties restartParameters)
throws javax.batch.operations.JobExecutionAlreadyCompleteException,
javax.batch.operations.NoSuchJobExecutionException,
javax.batch.operations.JobExecutionNotMostRecentException,
javax.batch.operations.JobRestartException,
javax.batch.operations.JobSecurityException
restart in interface javax.batch.operations.JobOperatorrestart in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.JobExecutionAlreadyCompleteExceptionjavax.batch.operations.NoSuchJobExecutionExceptionjavax.batch.operations.JobExecutionNotMostRecentExceptionjavax.batch.operations.JobRestartExceptionjavax.batch.operations.JobSecurityExceptionpublic void stop(long executionId)
throws javax.batch.operations.NoSuchJobExecutionException,
javax.batch.operations.JobExecutionNotRunningException,
javax.batch.operations.JobSecurityException
stop in interface javax.batch.operations.JobOperatorstop in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.NoSuchJobExecutionExceptionjavax.batch.operations.JobExecutionNotRunningExceptionjavax.batch.operations.JobSecurityExceptionpublic void abandon(long executionId)
throws javax.batch.operations.NoSuchJobExecutionException,
javax.batch.operations.JobExecutionIsRunningException,
javax.batch.operations.JobSecurityException
abandon in interface javax.batch.operations.JobOperatorabandon in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.NoSuchJobExecutionExceptionjavax.batch.operations.JobExecutionIsRunningExceptionjavax.batch.operations.JobSecurityExceptionpublic javax.batch.runtime.JobInstance getJobInstance(long executionId)
throws javax.batch.operations.NoSuchJobExecutionException,
javax.batch.operations.JobSecurityException
getJobInstance in interface javax.batch.operations.JobOperatorgetJobInstance in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.NoSuchJobExecutionExceptionjavax.batch.operations.JobSecurityExceptionpublic List<javax.batch.runtime.JobExecution> getJobExecutions(javax.batch.runtime.JobInstance instance) throws javax.batch.operations.NoSuchJobInstanceException, javax.batch.operations.JobSecurityException
getJobExecutions in interface javax.batch.operations.JobOperatorgetJobExecutions in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.NoSuchJobInstanceExceptionjavax.batch.operations.JobSecurityExceptionpublic javax.batch.runtime.JobExecution getJobExecution(long executionId)
throws javax.batch.operations.NoSuchJobExecutionException,
javax.batch.operations.JobSecurityException
getJobExecution in interface javax.batch.operations.JobOperatorgetJobExecution in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.NoSuchJobExecutionExceptionjavax.batch.operations.JobSecurityExceptionpublic List<javax.batch.runtime.StepExecution> getStepExecutions(long jobExecutionId) throws javax.batch.operations.NoSuchJobExecutionException, javax.batch.operations.JobSecurityException
getStepExecutions in interface javax.batch.operations.JobOperatorgetStepExecutions in class org.jberet.operations.AbstractJobOperatorjavax.batch.operations.NoSuchJobExecutionExceptionjavax.batch.operations.JobSecurityExceptionpublic Collection<String> getJobXmlNames()
public Collection<String> getJobXmlNames(String jobName)
jobName - the job name to find the XML descriptors forpublic Set<String> getAllJobNames()
JobOperator.getJobNames()
as they may not exist in the job repository.public org.jboss.msc.value.InjectedValue<BatchConfiguration> getBatchConfigurationInjector()
public org.jboss.msc.inject.Injector<SecurityAwareBatchEnvironment> getBatchEnvironmentInjector()
public org.jboss.msc.inject.Injector<ExecutorService> getExecutorServiceInjector()
public org.jboss.msc.value.InjectedValue<org.jboss.as.server.suspend.SuspendController> getSuspendControllerInjector()
public <T> T allowMissingJob(Supplier<T> supplier, T defaultValue)
NoSuchJobException thrown. If the exception is thrown the
default value is returned, otherwise the value from the supplier is returned.T - the return typesupplier - the supplier for the valuedefaultValue - the default value if a NoSuchJobException is thrownNoSuchJobException was thrownCopyright © 2018 JBoss by Red Hat. All rights reserved.