/** * Creates a new JAXB host registration based on an existing host registration * * @param hostRegistration */ public JaxbHostRegistration(HostRegistration hostRegistration) { this.baseUrl = hostRegistration.getBaseUrl(); this.address = hostRegistration.getIpAddress(); this.memory = hostRegistration.getMemory(); this.cores = hostRegistration.getCores(); this.maxLoad = hostRegistration.getMaxLoad(); this.online = hostRegistration.isOnline(); this.active = hostRegistration.isActive(); this.maintenanceMode = hostRegistration.isMaintenanceMode(); }
public void updateHost(HostRegistration host) { if (!host.isActive()) { hosts.remove(host.toString()); logger.trace("Removing inactive host '{}'", host); return; } if (host.isOnline() && !host.isMaintenanceMode()) { hosts.put(host.toString(), ONLINE); } else if (host.isOnline() && host.isMaintenanceMode()) { hosts.put(host.toString(), MAINTENANCE); } else { hosts.put(host.toString(), OFFLINE); } sendNotification(JmxUtil.createUpdateNotification(this, sequenceNumber++, "Host updated")); }
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#getMaxLoads() */ @Override public SystemLoad getMaxLoads() throws ServiceRegistryException { final SystemLoad loads = new SystemLoad(); for (HostRegistration host : getHostRegistrations()) { NodeLoad load = new NodeLoad(host.getBaseUrl(), host.getMaxLoad()); loads.addNodeLoad(load); } return loads; }
@Override public String apply(HostRegistration h) { return h.getBaseUrl(); } };
@Override public Float apply(HostRegistration h) { return h.getMaxLoad(); } };
if (host.getBaseUrl().equals(service.getHost())) { hostLoadMax = host.getMaxLoad(); break;
@Override public boolean equals(Object obj) { if (!(obj instanceof HostRegistration)) return false; HostRegistration registration = (HostRegistration) obj; return baseUrl.equals(registration.getBaseUrl()); }
public static void checkJobFitsCluster(float load, String loadType, List<HostRegistration> hosts) { boolean processable = false; if (hosts != null) { for (HostRegistration host : hosts) { if (host.getMaxLoad() >= load) { logger.trace("Host " + host.toString() + " can process jobs of type " + loadType + " with load " + load); processable = true; break; } } } if (!processable) { logger.warn("No hosts found that can process jobs of type {} with load {}", loadType, load); } } }
/** * {@inheritDoc} * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (!(obj instanceof HostRegistration)) return false; HostRegistration registration = (HostRegistration) obj; return baseUrl.equals(registration.getBaseUrl()); }
@Override public Boolean apply(HostRegistration host, Long jobId) { if (dispatchPriorityList.values().contains(host.getBaseUrl()) && !host.getBaseUrl().equals(dispatchPriorityList.get(jobId))) { return false; } return true; } };
if (!systemLoad.containsHost(h.getBaseUrl())) { systemLoad.addNodeLoad(new NodeLoad(h.getBaseUrl(), 0.0f));