@Override public boolean isAlive(InetAddress ep) { if (ep.equals(Utils.getBroadcastAddress())) return true; EndpointState epState = Gossiper.instance.getEndpointStateForEndpoint(ep); // we could assert not-null, but having isAlive fail screws a node over so badly that // it's worth being defensive here so minor bugs don't cause disproportionate // badness. (See lealone-1463 for an example). if (epState == null) logger.error("unknown endpoint {}", ep); return epState != null && epState.isAlive(); }
/** * Return the rack for which an endpoint resides in * * @param endpoint the endpoint to process * @return string of rack */ @Override public String getRack(InetAddress endpoint) { if (endpoint.equals(Utils.getBroadcastAddress())) return myRack; EndpointState epState = Gossiper.instance.getEndpointStateForEndpoint(endpoint); if (epState == null || epState.getApplicationState(ApplicationState.RACK) == null) { if (psnitch == null) { if (savedEndpoints == null) savedEndpoints = ClusterMetaData.loadDcRackInfo(); if (savedEndpoints.containsKey(endpoint)) return savedEndpoints.get(endpoint).get("rack"); return DEFAULT_RACK; } else return psnitch.getRack(endpoint); } return epState.getApplicationState(ApplicationState.RACK).value; }