private void updateInstanceLiveness(List<LiveInstance> liveInstances) {
      Set<String> liveInstancesSet = new HashSet<>();
      liveInstances.forEach(e -> liveInstancesSet.add(e.getInstanceName()));
      for (String instanceName : allInstances) {
        // Here we ignore live instance change it's about self instance. The reason is, during server's startup, current
        // node should be AVAILABLE but the list of live instances doesn't include current node since it hasn't joined yet.
        if (liveInstancesSet.contains(instanceName) || instanceName.equals(selfInstanceName)) {
          instanceNameToAmbryDataNode.get(instanceName).setState(HardwareState.AVAILABLE);
        } else {
          instanceNameToAmbryDataNode.get(instanceName).setState(HardwareState.UNAVAILABLE);
        }
      }
    }
Update the liveness states of existing instances based on the input.
@param liveInstances the list of instances that are up.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixClusterManager.java