use of org.opencastproject.serviceregistry.api.HostRegistration in project opencast by opencast.
the class ServiceRegistryJpaImpl method getServiceRegistrationsByLoad.
/**
* 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.
*
* {@inheritDoc}
*
* @see org.opencastproject.serviceregistry.api.ServiceRegistry#getServiceRegistrationsByLoad(java.lang.String)
*/
@Override
public List<ServiceRegistration> getServiceRegistrationsByLoad(String serviceType) throws ServiceRegistryException {
EntityManager em = null;
try {
em = emf.createEntityManager();
SystemLoad loadByHost = getHostLoads(em);
List<HostRegistration> hostRegistrations = getHostRegistrations();
List<ServiceRegistration> serviceRegistrations = getServiceRegistrationsByType(serviceType);
return getServiceRegistrationsByLoad(serviceType, serviceRegistrations, hostRegistrations, loadByHost);
} finally {
if (em != null)
em.close();
}
}
Aggregations