Class ServiceRegistryJpaImpl
java.lang.Object
org.opencastproject.serviceregistry.impl.ServiceRegistryJpaImpl
- All Implemented Interfaces:
org.opencastproject.serviceregistry.api.ServiceRegistry,org.osgi.service.cm.ManagedService
public class ServiceRegistryJpaImpl
extends Object
implements org.opencastproject.serviceregistry.api.ServiceRegistry, org.osgi.service.cm.ManagedService
JPA implementation of the
ServiceRegistry-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BooleanWhether to accept a job whose load exceeds the host’s max loadprotected org.opencastproject.security.api.TrustedHttpClientThe http client to use when connecting to remote serversprotected booleanWhether to collect detailed job statisticsprotected org.opencastproject.db.DBSessionprotected org.opencastproject.db.DBSessionFactoryprotected javax.persistence.EntityManagerFactoryThe factory used to generate the entity managerprotected static doubleThreshold value under which defined workers get preferred when dispatching encoding jobsComma-seperate list with URLs of encoding specialised workersprotected StringThis host's base URLprotected org.opencastproject.serviceregistry.api.Incidentsprotected org.opencastproject.serviceregistry.api.IncidentServiceprotected List<ObjectInstance> The list of registered JMX beansprotected static final List<org.opencastproject.job.api.Job.Status> A static list of statuses that influence how load balancing is calculatedprotected StringThe base URL for job URLsprotected floatprotected intNumber of failed jobs on a service before to set it in error state. -1 will disable error states completely.protected intMaximum age of jobs being considering for service statisticsprotected StringThis host's descriptive node name eg admin, worker01protected static final StringConfiguration key for the encoding workers load thresholdprotected static final StringConfiguration key for the encoding preferred worker nodesprotected static final StringConfiguration key for the interval to check whether the hosts in the service registry are still alive, in secondsprotected static final StringConfiguration key for the collection of job statisticsprotected static final StringConfiguration key for the maximum loadprotected static final StringConfiguration key for the retrieval of service statistics: Do not consider jobs older than max_job_age (in days)static final StringJPA persistence unit namestatic final StringId of the workflow's resume operation, need to match the corresponding enum value in WorkflowServiceImplprotected ScheduledExecutorServiceThe thread pool to use for dispatching queued jobs and checking on phantom services.protected org.opencastproject.security.api.SecurityServiceThe security servicestatic final StringId of the workflow's start operation operation, need to match the corresponding enum value in WorkflowServiceImplstatic final StringId of the workflow's start workflow operation, need to match the corresponding enum value in WorkflowServiceImplstatic final StringIdentifier for the workflow service -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) longcount(String serviceType, String host, String operation, org.opencastproject.job.api.Job.Status status) longcountActiveTypeByOrganization(String operation) longcountByHost(String serviceType, String host, org.opencastproject.job.api.Job.Status status) longcountByOperation(String serviceType, String operation, org.opencastproject.job.api.Job.Status status) org.opencastproject.job.api.Joborg.opencastproject.job.api.JobcreateJob(String host, String serviceType, String operation, List<String> arguments, String payload, boolean dispatchable, org.opencastproject.job.api.Job parentJob) Creates a job on a remote host with a jobLoad of 1.0.org.opencastproject.job.api.JobcreateJob(String host, String serviceType, String operation, List<String> arguments, String payload, boolean dispatchable, org.opencastproject.job.api.Job parentJob, float jobLoad) Creates a job on a remote host.org.opencastproject.job.api.Joborg.opencastproject.job.api.Joborg.opencastproject.job.api.JobcreateJob(String type, String operation, List<String> arguments, String payload, boolean dispatchable) org.opencastproject.job.api.JobcreateJob(String type, String operation, List<String> arguments, String payload, boolean dispatchable, Float jobLoad) org.opencastproject.job.api.JobcreateJob(String type, String operation, List<String> arguments, String payload, boolean dispatchable, org.opencastproject.job.api.Job parentJob) org.opencastproject.job.api.JobcreateJob(String type, String operation, List<String> arguments, String payload, boolean dispatchable, org.opencastproject.job.api.Job parentJob, Float jobLoad) voidvoiddisableHost(String host) voidenableHost(String host) protected Function<javax.persistence.EntityManager, Optional<org.opencastproject.serviceregistry.impl.jpa.HostRegistrationJpaImpl>> Fetches a host registration from persistence.List<org.opencastproject.job.api.Job> List<org.opencastproject.job.api.Job> getChildJobs(long id) org.opencastproject.serviceregistry.api.SystemLoadorg.opencastproject.job.api.JobgetDispatchableJobsWithStatusQuery(int offset, int limit, org.opencastproject.job.api.Job.Status... statuses) Gets jobs of all types that are in the given state.org.opencastproject.serviceregistry.api.HostRegistrationgetHostRegistration(String hostname) protected Function<javax.persistence.EntityManager, org.opencastproject.serviceregistry.api.HostRegistration> getHostRegistrationQuery(String hostname) List<org.opencastproject.serviceregistry.api.HostRegistration> Gets all host registrationsprotected Function<javax.persistence.EntityManager, List<org.opencastproject.serviceregistry.api.HostRegistration>> Gets all host registrationsorg.opencastproject.serviceregistry.api.HostStatisticsorg.opencastproject.job.api.JobgetJob(long id) intgetJobCount(String operation) getJobPayloads(String operation) getJobPayloads(String operation, int limit, int offset) List<org.opencastproject.job.api.Job> getJobsByStatusQuery(org.opencastproject.job.api.Job.Status... statuses) Get the list of jobs with status from the given statuses.org.opencastproject.serviceregistry.api.SystemLoad.NodeLoadgetMaxLoadOnNode(String host) org.opencastproject.serviceregistry.api.SystemLoadfloatorg.opencastproject.serviceregistry.api.ServiceRegistrationgetServiceRegistration(String serviceType, String host) protected Function<javax.persistence.EntityManager, Optional<org.opencastproject.serviceregistry.impl.jpa.ServiceRegistrationJpaImpl>> getServiceRegistrationQuery(String serviceType, String host) List<org.opencastproject.serviceregistry.api.ServiceRegistration> List<org.opencastproject.serviceregistry.api.ServiceRegistration> List<org.opencastproject.serviceregistry.api.ServiceRegistration> getServiceRegistrationsByLoad(String serviceType) Do not look at this, it will burn your eyes!protected List<org.opencastproject.serviceregistry.api.ServiceRegistration> getServiceRegistrationsByLoad(String jobType, List<org.opencastproject.serviceregistry.api.ServiceRegistration> serviceRegistrations, List<org.opencastproject.serviceregistry.api.HostRegistration> hostRegistrations, org.opencastproject.serviceregistry.api.SystemLoad systemLoad) Returns a filtered list of service registrations, containing only those that are online, not in maintenance mode, and with a specific service type, ordered by load.List<org.opencastproject.serviceregistry.api.ServiceRegistration> getServiceRegistrationsByType(String serviceType) protected Function<javax.persistence.EntityManager, List<org.opencastproject.serviceregistry.api.ServiceRegistration>> Gets all service registrations.protected List<org.opencastproject.serviceregistry.api.ServiceRegistration> getServiceRegistrationsWithCapacity(String jobType, List<org.opencastproject.serviceregistry.api.ServiceRegistration> serviceRegistrations, List<org.opencastproject.serviceregistry.api.HostRegistration> hostRegistrations, org.opencastproject.serviceregistry.api.SystemLoad systemLoad) Returns a filtered list of service registrations, containing only those that are online, not in maintenance mode, and with a specific service type that are running on a host which is not already maxed out.List<org.opencastproject.serviceregistry.api.ServiceStatistics> org.opencastproject.serviceregistry.api.Incidentsincident()voidOSGI callback when the configuration is updated.voidregisterHost(String host, String address, String nodeName, long memory, int cores, float maxLoad) org.opencastproject.serviceregistry.api.ServiceRegistrationregisterService(String serviceType, String baseUrl, String path) org.opencastproject.serviceregistry.api.ServiceRegistrationregisterService(String serviceType, String baseUrl, String path, boolean jobProducer) voidremoveJobs(List<Long> jobIds) voidremoveParentlessJobs(int lifetime) voidvoidsetCurrentJob(org.opencastproject.job.api.Job job) voidsetDBSessionFactory(org.opencastproject.db.DBSessionFactory dbSessionFactory) voidsetIncidentService(org.opencastproject.serviceregistry.api.IncidentService incidentService) OSGi DI.protected org.opencastproject.job.jpa.JpaJobsetJobUri(org.opencastproject.job.jpa.JpaJob job) voidsetMaintenanceStatus(String baseUrl, boolean maintenance) protected org.opencastproject.serviceregistry.api.ServiceRegistrationsetOnlineStatus(String serviceType, String baseUrl, String path, boolean online, Boolean jobProducer) Sets the online status of a service registration.voidsetSecurityService(org.opencastproject.security.api.SecurityService securityService) Callback for setting the security service.voidunregisterHost(String host) voidunRegisterService(String serviceType, String baseUrl) voidunsetIncidentService(org.opencastproject.serviceregistry.api.IncidentService incidentService) voidupdated(Dictionary properties) protected org.opencastproject.job.jpa.JpaJobupdateInternal(org.opencastproject.job.jpa.JpaJob job) Internal method to update a job, throwing unwrapped JPA exceptions.org.opencastproject.job.api.JobupdateJob(org.opencastproject.job.api.Job job) void
-
Field Details
-
PERSISTENCE_UNIT
JPA persistence unit name- See Also:
-
START_OPERATION
Id of the workflow's start operation operation, need to match the corresponding enum value in WorkflowServiceImpl- See Also:
-
START_WORKFLOW
Id of the workflow's start workflow operation, need to match the corresponding enum value in WorkflowServiceImpl- See Also:
-
RESUME
Id of the workflow's resume operation, need to match the corresponding enum value in WorkflowServiceImpl- See Also:
-
TYPE_WORKFLOW
Identifier for the workflow service- See Also:
-
jmxBeans
The list of registered JMX beans -
OPT_MAXLOAD
Configuration key for the maximum load- See Also:
-
OPT_HEARTBEATINTERVAL
Configuration key for the interval to check whether the hosts in the service registry are still alive, in seconds- See Also:
-
OPT_JOBSTATISTICS
Configuration key for the collection of job statistics- See Also:
-
OPT_SERVICE_STATISTICS_MAX_JOB_AGE
Configuration key for the retrieval of service statistics: Do not consider jobs older than max_job_age (in days)- See Also:
-
OPT_ENCODING_WORKERS
Configuration key for the encoding preferred worker nodes- See Also:
-
OPT_ENCODING_THRESHOLD
Configuration key for the encoding workers load threshold- See Also:
-
client
protected org.opencastproject.security.api.TrustedHttpClient clientThe http client to use when connecting to remote servers -
maxAttemptsBeforeErrorState
protected int maxAttemptsBeforeErrorStateNumber of failed jobs on a service before to set it in error state. -1 will disable error states completely. -
hostName
This host's base URL -
nodeName
This host's descriptive node name eg admin, worker01 -
jobHost
The base URL for job URLs -
encodingWorkers
Comma-seperate list with URLs of encoding specialised workers -
encodingThreshold
protected static double encodingThresholdThreshold value under which defined workers get preferred when dispatching encoding jobs -
emf
protected javax.persistence.EntityManagerFactory emfThe factory used to generate the entity manager -
dbSessionFactory
protected org.opencastproject.db.DBSessionFactory dbSessionFactory -
db
protected org.opencastproject.db.DBSession db -
scheduledExecutor
The thread pool to use for dispatching queued jobs and checking on phantom services. -
securityService
protected org.opencastproject.security.api.SecurityService securityServiceThe security service -
incidentService
protected org.opencastproject.serviceregistry.api.IncidentService incidentService -
incidents
protected org.opencastproject.serviceregistry.api.Incidents incidents -
collectJobstats
protected boolean collectJobstatsWhether to collect detailed job statistics -
maxJobAge
protected int maxJobAgeMaximum age of jobs being considering for service statistics -
JOB_STATUSES_INFLUENCING_LOAD_BALANCING
protected static final List<org.opencastproject.job.api.Job.Status> JOB_STATUSES_INFLUENCING_LOAD_BALANCINGA static list of statuses that influence how load balancing is calculated -
jobCache
-
acceptJobLoadsExeedingMaxLoad
Whether to accept a job whose load exceeds the host’s max load -
localSystemLoad
protected float localSystemLoad
-
-
Constructor Details
-
ServiceRegistryJpaImpl
public ServiceRegistryJpaImpl()
-
-
Method Details
-
setDBSessionFactory
public void setDBSessionFactory(org.opencastproject.db.DBSessionFactory dbSessionFactory) -
activate
public void activate(org.osgi.service.component.ComponentContext cc) -
getOwnLoad
public float getOwnLoad()- Specified by:
getOwnLoadin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry
-
getRegistryHostname
- Specified by:
getRegistryHostnamein interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry
-
deactivate
public void deactivate() -
createJob
public org.opencastproject.job.api.Job createJob(String type, String operation) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
createJobin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
createJob
public org.opencastproject.job.api.Job createJob(String type, String operation, List<String> arguments) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
createJobin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
createJob
public org.opencastproject.job.api.Job createJob(String type, String operation, List<String> arguments, Float jobLoad) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
createJobin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
createJob
public org.opencastproject.job.api.Job createJob(String type, String operation, List<String> arguments, String payload, boolean dispatchable) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
createJobin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
createJob
public org.opencastproject.job.api.Job createJob(String type, String operation, List<String> arguments, String payload, boolean dispatchable, Float jobLoad) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
createJobin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
createJob
public org.opencastproject.job.api.Job createJob(String type, String operation, List<String> arguments, String payload, boolean dispatchable, org.opencastproject.job.api.Job parentJob) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException
-
createJob
public org.opencastproject.job.api.Job createJob(String type, String operation, List<String> arguments, String payload, boolean dispatchable, org.opencastproject.job.api.Job parentJob, Float jobLoad) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
createJobin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
createJob
public org.opencastproject.job.api.Job createJob(String host, String serviceType, String operation, List<String> arguments, String payload, boolean dispatchable, org.opencastproject.job.api.Job parentJob) throws org.opencastproject.serviceregistry.api.ServiceRegistryException Creates a job on a remote host with a jobLoad of 1.0.- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException
-
createJob
public org.opencastproject.job.api.Job createJob(String host, String serviceType, String operation, List<String> arguments, String payload, boolean dispatchable, org.opencastproject.job.api.Job parentJob, float jobLoad) throws org.opencastproject.serviceregistry.api.ServiceRegistryException Creates a job on a remote host.- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException
-
removeJobs
public void removeJobs(List<Long> jobIds) throws org.opencastproject.util.NotFoundException, org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
removeJobsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.util.NotFoundExceptionorg.opencastproject.serviceregistry.api.ServiceRegistryException
-
removeParentlessJobs
public void removeParentlessJobs(int lifetime) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
removeParentlessJobsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException
-
updated
- Specified by:
updatedin interfaceorg.osgi.service.cm.ManagedService- Throws:
org.osgi.service.cm.ConfigurationException- See Also:
-
modified
OSGI callback when the configuration is updated. This method is only here to prevent the configuration admin service from calling the service deactivate and activate methods for a config update. It does not have to do anything as the updates are handled by updated().- Throws:
org.osgi.service.cm.ConfigurationException
-
getJob
public org.opencastproject.job.api.Job getJob(long id) throws org.opencastproject.util.NotFoundException, org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
getJobin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.util.NotFoundExceptionorg.opencastproject.serviceregistry.api.ServiceRegistryException
-
getCurrentJob
public org.opencastproject.job.api.Job getCurrentJob()- Specified by:
getCurrentJobin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- See Also:
-
setCurrentJob
public void setCurrentJob(org.opencastproject.job.api.Job job) - Specified by:
setCurrentJobin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- See Also:
-
updateJob
public org.opencastproject.job.api.Job updateJob(org.opencastproject.job.api.Job job) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
updateJobin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException
-
setJobUri
protected org.opencastproject.job.jpa.JpaJob setJobUri(org.opencastproject.job.jpa.JpaJob job) -
updateInternal
protected org.opencastproject.job.jpa.JpaJob updateInternal(org.opencastproject.job.jpa.JpaJob job) throws org.opencastproject.util.NotFoundException Internal method to update a job, throwing unwrapped JPA exceptions.- Parameters:
job- the job to update- Returns:
- the updated job
- Throws:
org.opencastproject.util.NotFoundException
-
updateStatisticsJobData
public void updateStatisticsJobData() -
fetchHostRegistrationQuery
protected Function<javax.persistence.EntityManager,Optional<org.opencastproject.serviceregistry.impl.jpa.HostRegistrationJpaImpl>> fetchHostRegistrationQuery(String host) Fetches a host registration from persistence.- Parameters:
host- the host name- Returns:
- the host registration, or null if none exists
-
registerHost
public void registerHost(String host, String address, String nodeName, long memory, int cores, float maxLoad) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
registerHostin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
unregisterHost
public void unregisterHost(String host) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
unregisterHostin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
enableHost
public void enableHost(String host) throws org.opencastproject.serviceregistry.api.ServiceRegistryException, org.opencastproject.util.NotFoundException - Specified by:
enableHostin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryExceptionorg.opencastproject.util.NotFoundException- See Also:
-
disableHost
public void disableHost(String host) throws org.opencastproject.serviceregistry.api.ServiceRegistryException, org.opencastproject.util.NotFoundException - Specified by:
disableHostin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryExceptionorg.opencastproject.util.NotFoundException- See Also:
-
registerService
public org.opencastproject.serviceregistry.api.ServiceRegistration registerService(String serviceType, String baseUrl, String path) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
registerServicein interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
registerService
public org.opencastproject.serviceregistry.api.ServiceRegistration registerService(String serviceType, String baseUrl, String path, boolean jobProducer) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
registerServicein interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
getServiceRegistrationQuery
-
setOnlineStatus
protected org.opencastproject.serviceregistry.api.ServiceRegistration setOnlineStatus(String serviceType, String baseUrl, String path, boolean online, Boolean jobProducer) throws org.opencastproject.serviceregistry.api.ServiceRegistryException Sets the online status of a service registration.- Parameters:
serviceType- The job typebaseUrl- the host URLonline- whether the service is online or offjobProducer- whether this service produces jobs for long running operations- Returns:
- the service registration
- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException
-
unRegisterService
public void unRegisterService(String serviceType, String baseUrl) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
unRegisterServicein interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
setMaintenanceStatus
public void setMaintenanceStatus(String baseUrl, boolean maintenance) throws org.opencastproject.util.NotFoundException - Specified by:
setMaintenanceStatusin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.util.NotFoundException- See Also:
-
getServiceRegistrations
- Specified by:
getServiceRegistrationsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- See Also:
-
incident
public org.opencastproject.serviceregistry.api.Incidents incident()- Specified by:
incidentin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry
-
getServiceRegistrationsQuery
protected Function<javax.persistence.EntityManager,List<org.opencastproject.serviceregistry.api.ServiceRegistration>> getServiceRegistrationsQuery()Gets all service registrations.- Returns:
- the list of service registrations
-
getHostRegistrations
Gets all host registrations- Specified by:
getHostRegistrationsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Returns:
- the list of host registrations
-
getHostStatistics
public org.opencastproject.serviceregistry.api.HostStatistics getHostStatistics()- Specified by:
getHostStatisticsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry
-
getHostRegistrationsQuery
protected Function<javax.persistence.EntityManager,List<org.opencastproject.serviceregistry.api.HostRegistration>> getHostRegistrationsQuery()Gets all host registrations- Returns:
- the list of host registrations
-
getHostRegistration
public org.opencastproject.serviceregistry.api.HostRegistration getHostRegistration(String hostname) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
getHostRegistrationin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException
-
getHostRegistrationQuery
-
getChildJobs
public List<org.opencastproject.job.api.Job> getChildJobs(long id) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
getChildJobsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
getJobs
public List<org.opencastproject.job.api.Job> getJobs(String type, org.opencastproject.job.api.Job.Status status) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
getJobsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
getJobPayloads
public List<String> getJobPayloads(String operation) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
getJobPayloadsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException
-
getJobPayloads
public List<String> getJobPayloads(String operation, int limit, int offset) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
getJobPayloadsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException
-
getJobCount
public int getJobCount(String operation) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
getJobCountin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException
-
getActiveJobs
public List<org.opencastproject.job.api.Job> getActiveJobs() throws org.opencastproject.serviceregistry.api.ServiceRegistryException- Specified by:
getActiveJobsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
getJobsByStatusQuery
public Function<javax.persistence.EntityManager,List<org.opencastproject.job.jpa.JpaJob>> getJobsByStatusQuery(org.opencastproject.job.api.Job.Status... statuses) Get the list of jobs with status from the given statuses.- Parameters:
statuses- variable sized array of status values to test on jobs- Returns:
- list of jobs with status from statuses
-
countActiveByOrganizationAndHost
- Specified by:
countActiveByOrganizationAndHostin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry
-
countActiveTypeByOrganization
- Specified by:
countActiveTypeByOrganizationin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry
-
getDispatchableJobsWithStatusQuery
protected Function<javax.persistence.EntityManager,List<org.opencastproject.job.jpa.JpaJob>> getDispatchableJobsWithStatusQuery(int offset, int limit, org.opencastproject.job.api.Job.Status... statuses) Gets jobs of all types that are in the given state.- Parameters:
offset- apply offset to the db query if offset > 0limit- apply limit to the db query if limit > 0statuses- the job status should be one from the given statuses- Returns:
- the list of jobs waiting for dispatch
-
count
public long count(String serviceType, org.opencastproject.job.api.Job.Status status) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
countin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
countByHost
public long countByHost(String serviceType, String host, org.opencastproject.job.api.Job.Status status) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
countByHostin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
countByOperation
public long countByOperation(String serviceType, String operation, org.opencastproject.job.api.Job.Status status) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
countByOperationin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
count
public long count(String serviceType, String host, String operation, org.opencastproject.job.api.Job.Status status) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
countin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
getServiceStatistics
public List<org.opencastproject.serviceregistry.api.ServiceStatistics> getServiceStatistics() throws org.opencastproject.serviceregistry.api.ServiceRegistryException- Specified by:
getServiceStatisticsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
getServiceRegistrationsByLoad
public List<org.opencastproject.serviceregistry.api.ServiceRegistration> getServiceRegistrationsByLoad(String serviceType) throws org.opencastproject.serviceregistry.api.ServiceRegistryException Do not look at this, it will burn your eyes! This is due to JPA's inability to do a left outer join with join conditions.- Specified by:
getServiceRegistrationsByLoadin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
getCurrentHostLoads
public org.opencastproject.serviceregistry.api.SystemLoad getCurrentHostLoads()- Specified by:
getCurrentHostLoadsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- See Also:
-
getServiceRegistrationsByType
public List<org.opencastproject.serviceregistry.api.ServiceRegistration> getServiceRegistrationsByType(String serviceType) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
getServiceRegistrationsByTypein interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
getServiceRegistrationsByHost
public List<org.opencastproject.serviceregistry.api.ServiceRegistration> getServiceRegistrationsByHost(String host) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
getServiceRegistrationsByHostin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
getServiceRegistration
public org.opencastproject.serviceregistry.api.ServiceRegistration getServiceRegistration(String serviceType, String host) - Specified by:
getServiceRegistrationin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- See Also:
-
setSecurityService
public void setSecurityService(org.opencastproject.security.api.SecurityService securityService) Callback for setting the security service.- Parameters:
securityService- the securityService to set
-
setIncidentService
public void setIncidentService(org.opencastproject.serviceregistry.api.IncidentService incidentService) OSGi DI. -
unsetIncidentService
public void unsetIncidentService(org.opencastproject.serviceregistry.api.IncidentService incidentService) -
sanitize
public void sanitize(String serviceType, String host) throws org.opencastproject.util.NotFoundException - Specified by:
sanitizein interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.util.NotFoundException- See Also:
-
getServiceRegistrationsWithCapacity
protected List<org.opencastproject.serviceregistry.api.ServiceRegistration> getServiceRegistrationsWithCapacity(String jobType, List<org.opencastproject.serviceregistry.api.ServiceRegistration> serviceRegistrations, List<org.opencastproject.serviceregistry.api.HostRegistration> hostRegistrations, org.opencastproject.serviceregistry.api.SystemLoad systemLoad) Returns a filtered list of service registrations, containing only those that are online, not in maintenance mode, and with a specific service type that are running on a host which is not already maxed out.- Parameters:
jobType- the job type for which the services registrations are filteredserviceRegistrations- the complete list of service registrationshostRegistrations- the complete list of available host registrationssystemLoad- the map of hosts to the number of running jobs
-
getServiceRegistrationsByLoad
protected List<org.opencastproject.serviceregistry.api.ServiceRegistration> getServiceRegistrationsByLoad(String jobType, List<org.opencastproject.serviceregistry.api.ServiceRegistration> serviceRegistrations, List<org.opencastproject.serviceregistry.api.HostRegistration> hostRegistrations, org.opencastproject.serviceregistry.api.SystemLoad systemLoad) Returns a filtered list of service registrations, containing only those that are online, not in maintenance mode, and with a specific service type, ordered by load.- Parameters:
jobType- the job type for which the services registrations are filteredserviceRegistrations- the complete list of service registrationshostRegistrations- the complete list of available host registrationssystemLoad-
-
getMaxLoads
public org.opencastproject.serviceregistry.api.SystemLoad getMaxLoads() throws org.opencastproject.serviceregistry.api.ServiceRegistryException- Specified by:
getMaxLoadsin interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
getMaxLoadOnNode
public org.opencastproject.serviceregistry.api.SystemLoad.NodeLoad getMaxLoadOnNode(String host) throws org.opencastproject.serviceregistry.api.ServiceRegistryException, org.opencastproject.util.NotFoundException - Specified by:
getMaxLoadOnNodein interfaceorg.opencastproject.serviceregistry.api.ServiceRegistry- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryExceptionorg.opencastproject.util.NotFoundException- See Also:
-