/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#count(java.lang.String, * org.opencastproject.job.api.Job.Status) */ @Override public long count(String serviceType, Status status) throws ServiceRegistryException { return count(serviceType, null, null, status); }
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#createJob(java.lang.String, java.lang.String, Float) */ @Override public Job createJob(String type, String operation, Float jobLoad) throws ServiceRegistryException { return createJob(type, operation, null, null, true, 1.0f); }
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#getServiceRegistrationsByLoad(java.lang.String) */ @Override public List<ServiceRegistration> getServiceRegistrationsByLoad(String serviceType) throws ServiceRegistryException { return getServiceRegistrationsByType(serviceType); }
@Override public float getOwnLoad() { return getCurrentHostLoads().get(getRegistryHostname()).getLoadFactor(); }
public ServiceRegistryInMemoryImpl(JobProducer service, float maxLoad, SecurityService securityService, UserDirectoryService userDirectoryService, OrganizationDirectoryService organizationDirectoryService, IncidentService incidentService) throws ServiceRegistryException { //Note: total memory here isn't really the correct value, but we just need something (preferably non-zero) registerHost(LOCALHOST, LOCALHOST, Runtime.getRuntime().totalMemory(), Runtime.getRuntime().availableProcessors(), maxLoad); if (service != null) registerService(service, maxLoad); this.securityService = securityService; this.userDirectoryService = userDirectoryService; this.organizationDirectoryService = organizationDirectoryService; this.incidents = new Incidents(this, incidentService); this.dispatcher.scheduleWithFixedDelay(new JobDispatcher(), DEFAULT_DISPATCHER_TIMEOUT, DEFAULT_DISPATCHER_TIMEOUT, TimeUnit.MILLISECONDS); }
List<ServiceRegistration> registrations = getServiceRegistrationsByLoad(job.getJobType()); if (registrations.size() == 0) throw new ServiceUnavailableException("No service is available to handle jobs of type '" + job.getJobType() + "'"); job.setStatus(Status.DISPATCHING); try { job = updateJob(job); } catch (NotFoundException e) { throw new ServiceRegistryException("Job not found!", e); job = updateJob(job); } catch (NotFoundException e) { jobs.remove(job);
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#registerService(java.lang.String, java.lang.String, * java.lang.String) */ @Override public ServiceRegistration registerService(String serviceType, String host, String path) throws ServiceRegistryException { return registerService(serviceType, host, path, false); }
while (parentJobId != null && parentJobId > 0) { try { Job parentJob = getJob(job.getParentJobId()); if (parentJob.getParentJobId().equals(id)) { result.add(job);
if (Status.QUEUED.equals(job.getStatus())) { job.setStatus(Status.DISPATCHING); if (!dispatchJob(job)) { job.setStatus(Status.QUEUED);
/** * Method to register locally running services. * * @param localService * the service instance * @return the service registration * @throws ServiceRegistryException */ public ServiceRegistration registerService(JobProducer localService) throws ServiceRegistryException { return registerService(localService, Runtime.getRuntime().availableProcessors()); }
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#createJob(java.lang.String, java.lang.String, java.util.List, java.lang.String, boolean, org.opencastproject.job.api.Job) */ @Override public Job createJob(String type, String operation, List<String> arguments, String payload, boolean queueable, Job parentJob) throws ServiceRegistryException { return createJob(type, operation, arguments, payload, queueable, parentJob, 1.0f); }
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#countByOperation(java.lang.String, java.lang.String, * org.opencastproject.job.api.Job.Status) */ @Override public long countByOperation(String serviceType, String operation, Status status) throws ServiceRegistryException { return count(serviceType, null, operation, status); }
public Job createJob(String type, String operation, List<String> arguments, String payload, boolean queueable, Job parentJob, Float jobLoad) throws ServiceRegistryException { if (getServiceRegistrationsByType(type).size() == 0) logger.warn("Service " + type + " not available");
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#createJob(java.lang.String, java.lang.String, java.util.List, java.lang.String, boolean, Float) */ @Override public Job createJob(String type, String operation, List<String> arguments, String payload, boolean queueable, Float jobLoad) throws ServiceRegistryException { return createJob(type, operation, arguments, payload, queueable, null, jobLoad); }
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#countByHost(java.lang.String, java.lang.String, * org.opencastproject.job.api.Job.Status) */ @Override public long countByHost(String serviceType, String host, Status status) throws ServiceRegistryException { return count(serviceType, host, null, status); }
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#createJob(java.lang.String, java.lang.String, java.util.List, java.lang.String, Float) */ @Override public Job createJob(String type, String operation, List<String> arguments, String payload, Float jobLoad) throws ServiceRegistryException { return createJob(type, operation, arguments, payload, true, jobLoad); }
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#createJob(java.lang.String, java.lang.String, java.util.List, java.lang.String) */ @Override public Job createJob(String type, String operation, List<String> arguments, String payload) throws ServiceRegistryException { return createJob(type, operation, arguments, payload, true); }
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#createJob(java.lang.String, java.lang.String, java.util.List, java.lang.String, boolean) */ @Override public Job createJob(String type, String operation, List<String> arguments, String payload, boolean queueable) throws ServiceRegistryException { return createJob(type, operation, arguments, payload, queueable, null, 1.0f); }
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#createJob(java.lang.String, java.lang.String) */ @Override public Job createJob(String type, String operation) throws ServiceRegistryException { return createJob(type, operation, null, null, true); }
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#createJob(java.lang.String, java.lang.String, * java.util.List) */ @Override public Job createJob(String type, String operation, List<String> arguments) throws ServiceRegistryException { return createJob(type, operation, arguments, null, true); }