public abstract class AbstractJobProducer extends Object implements JobProducer
JobProducer api to deal with handling long
running, asynchronous operations.| Modifier and Type | Field and Description |
|---|---|
static String |
ACCEPT_JOB_LOADS_EXCEEDING_PROPERTY
The key to look for in the service configuration file to override the
DEFAULT_ACCEPT_JOB_LOADS_EXCEEDING |
protected boolean |
acceptJobLoadsExeedingMaxLoad
Whether to accept a job whose load exceeds the host’s max load
|
static boolean |
DEFAULT_ACCEPT_JOB_LOADS_EXCEEDING
The default value whether to accept a job whose load exceeds the host’s max load
|
protected ExecutorService |
executor
To enable threading when dispatching jobs
|
protected String |
jobType
The types of job that this producer can handle
|
| Constructor and Description |
|---|
AbstractJobProducer(String jobType)
Creates a new abstract job producer for jobs of the given type.
|
| Modifier and Type | Method and Description |
|---|---|
void |
acceptJob(Job job)
Asks the job producer to handle the given job using the provided operation and list of arguments.
|
void |
activate(org.osgi.service.component.ComponentContext cc)
OSGI activate method.
|
long |
countJobs(Job.Status status)
Get the number of jobs in a current status on all nodes.
|
protected void |
finallyUpdateJob(Job job)
Private utility to update and optionally fail job, called from a finally block.
|
String |
getJobType()
The type of jobs that this producer creates.
|
protected abstract OrganizationDirectoryService |
getOrganizationDirectoryService()
Returns a reference to the organization directory service.
|
protected abstract SecurityService |
getSecurityService()
Returns a reference to the security service
|
protected abstract ServiceRegistry |
getServiceRegistry()
Returns a reference to the service registry.
|
protected abstract UserDirectoryService |
getUserDirectoryService()
Returns a reference to the user directory service
|
Incidents |
incident()
Shorthand for
getServiceRegistry().incident() |
boolean |
isReadyToAccept(Job job)
Whether the job can be accepted.
|
boolean |
isReadyToAcceptJobs(String operation)
Whether new jobs can be accepted in general.
|
protected abstract String |
process(Job job)
Asks the overriding class to process the arguments using the given operation.
|
public static final boolean DEFAULT_ACCEPT_JOB_LOADS_EXCEEDING
public static final String ACCEPT_JOB_LOADS_EXCEEDING_PROPERTY
DEFAULT_ACCEPT_JOB_LOADS_EXCEEDINGprotected boolean acceptJobLoadsExeedingMaxLoad
protected String jobType
protected ExecutorService executor
public AbstractJobProducer(String jobType)
jobType - the job typepublic void activate(org.osgi.service.component.ComponentContext cc)
cc - OSGI component contextpublic String getJobType()
getJobType in interface JobProducerJobProducer.getJobType()public long countJobs(Job.Status status) throws ServiceRegistryException
countJobs in interface JobProducerServiceRegistryException - if an error occurs while communicating with the backing data sourceJobProducer.countJobs(org.opencastproject.job.api.Job.Status)public void acceptJob(Job job) throws ServiceRegistryException
acceptJob in interface JobProducerjob - the job being dispatchedServiceRegistryException - if the producer was unable to start work as requestedJobProducer.acceptJob(org.opencastproject.job.api.Job)public boolean isReadyToAcceptJobs(String operation) throws ServiceRegistryException
isReadyToAcceptJobs in interface JobProduceroperation - operationServiceRegistryException - if the producer was unable to start work as requestedJobProducer.isReadyToAcceptJobs(String)public boolean isReadyToAccept(Job job) throws ServiceRegistryException, UndispatchableJobException
isReadyToAccept in interface JobProducerjob - the job being dispatchedServiceRegistryException - if the producer was unable to start work as requestedUndispatchableJobException - if the job will never be accepted because it is unacceptableJobProducer.isReadyToAccept(org.opencastproject.job.api.Job)protected void finallyUpdateJob(Job job)
job - to be updated, may be nullpublic Incidents incident()
getServiceRegistry().incident()protected abstract ServiceRegistry getServiceRegistry()
protected abstract SecurityService getSecurityService()
protected abstract UserDirectoryService getUserDirectoryService()
protected abstract OrganizationDirectoryService getOrganizationDirectoryService()
Copyright © 2009–2020 Opencast Project. All rights reserved.