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 Details

    • PERSISTENCE_UNIT

      public static final String PERSISTENCE_UNIT
      JPA persistence unit name
      See Also:
    • START_OPERATION

      public static final String START_OPERATION
      Id of the workflow's start operation operation, need to match the corresponding enum value in WorkflowServiceImpl
      See Also:
    • START_WORKFLOW

      public static final String START_WORKFLOW
      Id of the workflow's start workflow operation, need to match the corresponding enum value in WorkflowServiceImpl
      See Also:
    • RESUME

      public static final String RESUME
      Id of the workflow's resume operation, need to match the corresponding enum value in WorkflowServiceImpl
      See Also:
    • TYPE_WORKFLOW

      public static final String TYPE_WORKFLOW
      Identifier for the workflow service
      See Also:
    • jmxBeans

      protected List<ObjectInstance> jmxBeans
      The list of registered JMX beans
    • OPT_MAXLOAD

      protected static final String OPT_MAXLOAD
      Configuration key for the maximum load
      See Also:
    • OPT_HEARTBEATINTERVAL

      protected static final String 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

      protected static final String OPT_JOBSTATISTICS
      Configuration key for the collection of job statistics
      See Also:
    • OPT_SERVICE_STATISTICS_MAX_JOB_AGE

      protected static final String 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

      protected static final String OPT_ENCODING_WORKERS
      Configuration key for the encoding preferred worker nodes
      See Also:
    • OPT_ENCODING_THRESHOLD

      protected static final String OPT_ENCODING_THRESHOLD
      Configuration key for the encoding workers load threshold
      See Also:
    • client

      protected org.opencastproject.security.api.TrustedHttpClient client
      The http client to use when connecting to remote servers
    • maxAttemptsBeforeErrorState

      protected int maxAttemptsBeforeErrorState
      Number of failed jobs on a service before to set it in error state. -1 will disable error states completely.
    • hostName

      protected String hostName
      This host's base URL
    • nodeName

      protected String nodeName
      This host's descriptive node name eg admin, worker01
    • jobHost

      protected String jobHost
      The base URL for job URLs
    • encodingWorkers

      protected static List<String> encodingWorkers
      Comma-seperate list with URLs of encoding specialised workers
    • encodingThreshold

      protected static double encodingThreshold
      Threshold value under which defined workers get preferred when dispatching encoding jobs
    • emf

      protected javax.persistence.EntityManagerFactory emf
      The factory used to generate the entity manager
    • dbSessionFactory

      protected org.opencastproject.db.DBSessionFactory dbSessionFactory
    • db

      protected org.opencastproject.db.DBSession db
    • scheduledExecutor

      protected ScheduledExecutorService scheduledExecutor
      The thread pool to use for dispatching queued jobs and checking on phantom services.
    • securityService

      protected org.opencastproject.security.api.SecurityService securityService
      The security service
    • incidentService

      protected org.opencastproject.serviceregistry.api.IncidentService incidentService
    • incidents

      protected org.opencastproject.serviceregistry.api.Incidents incidents
    • collectJobstats

      protected boolean collectJobstats
      Whether to collect detailed job statistics
    • maxJobAge

      protected int maxJobAge
      Maximum 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_BALANCING
      A static list of statuses that influence how load balancing is calculated
    • jobCache

      protected static HashMap<Long,Float> jobCache
    • acceptJobLoadsExeedingMaxLoad

      protected Boolean 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:
      getOwnLoad in interface org.opencastproject.serviceregistry.api.ServiceRegistry
    • getRegistryHostname

      public String getRegistryHostname()
      Specified by:
      getRegistryHostname in interface org.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:
      createJob in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.createJob(java.lang.String, java.lang.String)
    • createJob

      public org.opencastproject.job.api.Job createJob(String type, String operation, List<String> arguments) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      createJob in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.createJob(java.lang.String, java.lang.String, java.util.List)
    • 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:
      createJob in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.createJob(java.lang.String, java.lang.String, java.util.List, Float)
    • 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:
      createJob in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.createJob(java.lang.String, java.lang.String, java.util.List, String, boolean)
    • 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:
      createJob in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.createJob(java.lang.String, java.lang.String, java.util.List, java.lang.String, boolean, Float)
    • 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:
      createJob in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.createJob(java.lang.String, java.lang.String, java.util.List, java.lang.String, boolean, org.opencastproject.job.api.Job, Float)
    • 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:
      removeJobs in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.util.NotFoundException
      org.opencastproject.serviceregistry.api.ServiceRegistryException
    • removeParentlessJobs

      public void removeParentlessJobs(int lifetime) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      removeParentlessJobs in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
    • updated

      public void updated(Dictionary properties) throws org.osgi.service.cm.ConfigurationException
      Specified by:
      updated in interface org.osgi.service.cm.ManagedService
      Throws:
      org.osgi.service.cm.ConfigurationException
      See Also:
      • ManagedService.updated(java.util.Dictionary)
    • modified

      public void modified(Map<String,Object> config) throws org.osgi.service.cm.ConfigurationException
      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:
      getJob in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.util.NotFoundException
      org.opencastproject.serviceregistry.api.ServiceRegistryException
    • getCurrentJob

      public org.opencastproject.job.api.Job getCurrentJob()
      Specified by:
      getCurrentJob in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      See Also:
      • ServiceRegistry.getCurrentJob()
    • setCurrentJob

      public void setCurrentJob(org.opencastproject.job.api.Job job)
      Specified by:
      setCurrentJob in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      See Also:
      • ServiceRegistry.setCurrentJob(Job)
    • updateJob

      public org.opencastproject.job.api.Job updateJob(org.opencastproject.job.api.Job job) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      updateJob in interface org.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:
      registerHost in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.registerHost(String, String, String, long, int, float)
    • unregisterHost

      public void unregisterHost(String host) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      unregisterHost in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.unregisterHost(java.lang.String)
    • enableHost

      public void enableHost(String host) throws org.opencastproject.serviceregistry.api.ServiceRegistryException, org.opencastproject.util.NotFoundException
      Specified by:
      enableHost in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      org.opencastproject.util.NotFoundException
      See Also:
      • ServiceRegistry.enableHost(String)
    • disableHost

      public void disableHost(String host) throws org.opencastproject.serviceregistry.api.ServiceRegistryException, org.opencastproject.util.NotFoundException
      Specified by:
      disableHost in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      org.opencastproject.util.NotFoundException
      See Also:
      • ServiceRegistry.disableHost(String)
    • registerService

      public org.opencastproject.serviceregistry.api.ServiceRegistration registerService(String serviceType, String baseUrl, String path) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      registerService in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.registerService(java.lang.String, java.lang.String, java.lang.String)
    • registerService

      public org.opencastproject.serviceregistry.api.ServiceRegistration registerService(String serviceType, String baseUrl, String path, boolean jobProducer) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      registerService in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.registerService(java.lang.String, java.lang.String, java.lang.String, boolean)
    • getServiceRegistrationQuery

      protected Function<javax.persistence.EntityManager,Optional<org.opencastproject.serviceregistry.impl.jpa.ServiceRegistrationJpaImpl>> getServiceRegistrationQuery(String serviceType, String host)
    • 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 type
      baseUrl - the host URL
      online - whether the service is online or off
      jobProducer - 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:
      unRegisterService in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.unRegisterService(java.lang.String, java.lang.String)
    • setMaintenanceStatus

      public void setMaintenanceStatus(String baseUrl, boolean maintenance) throws org.opencastproject.util.NotFoundException
      Specified by:
      setMaintenanceStatus in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.util.NotFoundException
      See Also:
      • ServiceRegistry.setMaintenanceStatus(java.lang.String, boolean)
    • getServiceRegistrations

      public List<org.opencastproject.serviceregistry.api.ServiceRegistration> getServiceRegistrations()
      Specified by:
      getServiceRegistrations in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      See Also:
      • ServiceRegistry.getServiceRegistrations()
    • incident

      public org.opencastproject.serviceregistry.api.Incidents incident()
      Specified by:
      incident in interface org.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

      public List<org.opencastproject.serviceregistry.api.HostRegistration> getHostRegistrations()
      Gets all host registrations
      Specified by:
      getHostRegistrations in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Returns:
      the list of host registrations
    • getHostStatistics

      public org.opencastproject.serviceregistry.api.HostStatistics getHostStatistics()
      Specified by:
      getHostStatistics in interface org.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:
      getHostRegistration in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
    • getHostRegistrationQuery

      protected Function<javax.persistence.EntityManager,org.opencastproject.serviceregistry.api.HostRegistration> getHostRegistrationQuery(String hostname)
    • getChildJobs

      public List<org.opencastproject.job.api.Job> getChildJobs(long id) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      getChildJobs in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.getChildJobs(long)
    • 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:
      getJobs in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.getJobs(java.lang.String, Status)
    • getJobPayloads

      public List<String> getJobPayloads(String operation) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      getJobPayloads in interface org.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:
      getJobPayloads in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
    • getJobCount

      public int getJobCount(String operation) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      getJobCount in interface org.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:
      getActiveJobs in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.getActiveJobs()
    • 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

      public Map<String,Map<String,Long>> countActiveByOrganizationAndHost()
      Specified by:
      countActiveByOrganizationAndHost in interface org.opencastproject.serviceregistry.api.ServiceRegistry
    • countActiveTypeByOrganization

      public Map<String,Long> countActiveTypeByOrganization(String operation)
      Specified by:
      countActiveTypeByOrganization in interface org.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 > 0
      limit - apply limit to the db query if limit > 0
      statuses - 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:
      count in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.count(java.lang.String, Status)
    • countByHost

      public long countByHost(String serviceType, String host, org.opencastproject.job.api.Job.Status status) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      countByHost in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.countByHost(java.lang.String, java.lang.String, Status)
    • countByOperation

      public long countByOperation(String serviceType, String operation, org.opencastproject.job.api.Job.Status status) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      countByOperation in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.countByOperation(java.lang.String, java.lang.String, Status)
    • 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:
      count in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.count(java.lang.String, java.lang.String, java.lang.String, Status)
    • getServiceStatistics

      public List<org.opencastproject.serviceregistry.api.ServiceStatistics> getServiceStatistics() throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      getServiceStatistics in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.getServiceStatistics()
    • 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:
      getServiceRegistrationsByLoad in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.getServiceRegistrationsByLoad(java.lang.String)
    • getCurrentHostLoads

      public org.opencastproject.serviceregistry.api.SystemLoad getCurrentHostLoads()
      Specified by:
      getCurrentHostLoads in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      See Also:
      • ServiceRegistry.getCurrentHostLoads()
    • getServiceRegistrationsByType

      public List<org.opencastproject.serviceregistry.api.ServiceRegistration> getServiceRegistrationsByType(String serviceType) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      getServiceRegistrationsByType in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.getServiceRegistrationsByType(java.lang.String)
    • getServiceRegistrationsByHost

      public List<org.opencastproject.serviceregistry.api.ServiceRegistration> getServiceRegistrationsByHost(String host) throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      getServiceRegistrationsByHost in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.getServiceRegistrationsByHost(java.lang.String)
    • getServiceRegistration

      public org.opencastproject.serviceregistry.api.ServiceRegistration getServiceRegistration(String serviceType, String host)
      Specified by:
      getServiceRegistration in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      See Also:
      • ServiceRegistry.getServiceRegistration(java.lang.String, java.lang.String)
    • 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:
      sanitize in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.util.NotFoundException
      See Also:
      • ServiceRegistry.sanitize(java.lang.String, java.lang.String)
    • 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 filtered
      serviceRegistrations - the complete list of service registrations
      hostRegistrations - the complete list of available host registrations
      systemLoad - 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 filtered
      serviceRegistrations - the complete list of service registrations
      hostRegistrations - the complete list of available host registrations
      systemLoad -
    • getMaxLoads

      public org.opencastproject.serviceregistry.api.SystemLoad getMaxLoads() throws org.opencastproject.serviceregistry.api.ServiceRegistryException
      Specified by:
      getMaxLoads in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      See Also:
      • ServiceRegistry.getMaxLoads()
    • getMaxLoadOnNode

      public org.opencastproject.serviceregistry.api.SystemLoad.NodeLoad getMaxLoadOnNode(String host) throws org.opencastproject.serviceregistry.api.ServiceRegistryException, org.opencastproject.util.NotFoundException
      Specified by:
      getMaxLoadOnNode in interface org.opencastproject.serviceregistry.api.ServiceRegistry
      Throws:
      org.opencastproject.serviceregistry.api.ServiceRegistryException
      org.opencastproject.util.NotFoundException
      See Also:
      • ServiceRegistry.getMaxLoadOnNode(java.lang.String)