private void removeFromReplicasFullyServing(Map<Domain, Map<Integer, Set<Host>>> domainToPartitionToHostsFullyServing, Host host) { for (Map<Integer, Set<Host>> partitionToHostsFullyServing : domainToPartitionToHostsFullyServing.values()) { for (Set<Host> hosts : partitionToHostsFullyServing.values()) { hosts.remove(host); } } status.clearObservations(host.getAddress().toString()); }
private static String formatHostListTooltip(String title, Set<Host> hosts) throws IOException { if (hosts.size() == 0) { return "-"; } else { TreeSet<Host> sortedHosts = new TreeSet<Host>(hosts); StringBuilder content = new StringBuilder(); for (Host host : sortedHosts) { content.append("<div class='" + hostStateToClass(host.getState()) + "'>"); content.append(host.getAddress().toString()); content.append("</div>"); } return htmlTooltip(Integer.toString(hosts.size()), title, content.toString()); } }
private void redirectBack(HttpServletResponse resp, RingGroup rgc, Ring rc, Host hc) throws IOException { resp.sendRedirect(String.format("/host.jsp?g=%s&r=%s&h=%s", rgc.getName(), rc.getRingNumber(), URLEnc.encode(hc.getAddress().toString()))); }
protected RingData getRingData(Ring ring) throws IOException { RingData data = new RingData(); data.ringNumber = ring.getRingNumber(); Map<String, HostData> hostMap = new HashMap<String, HostData>(); for (Host host : ring.getHosts()) { hostMap.put(host.getAddress().toString(), getHostData(host)); } data.hostsMap = hostMap; return data; }
@Override public Host addHost(PartitionServerAddress address, List<String> flags) throws IOException { try { // throws an exception if we can't parse the address PartitionServerAddress.parse(address.toString()); Host host = getHostByAddress(address); if(host != null){ throw new IllegalArgumentException("Host "+address+" already exists in ring "+getRingNumber()+"!"); } return ZkHost.create(zk, coordinator, ZkPath.append(ringPath, HOSTS_PATH_SEGMENT), address, dataLocationChangeListener, flags); } catch (Exception e) { throw new IOException(e); } }
public static String getHostUrl(RingGroup ringGroup, Ring ring, Host host) { return "host.jsp?g=" + URLEnc.encode(ringGroup.getName()) + "&r=" + ring.getRingNumber() + "&h=" + URLEnc.encode(host.getAddress().toString()); } }
boolean isObserved, HostReplicaStatus status) throws IOException { String key = host.getAddress().toString(); if (status.getObservations(key) == null) { status.clearObservations(key);