code: private void blacklistIfNeeded(
          String nodeName, List<FaultStatsForType> faultStats) {
      for (FaultStatsForType stat : faultStats) {
        if (isBlacklisted(nodeName, stat.type)) {
          continue;
        }
        if (tooManyFailuresOnNode(stat) ||
            tooManyConnectionFailuresOnNode(stat)) {
          nm.blacklistNode(nodeName, stat.type);
          blacklist(nodeName, stat.type);
        }
      }
    }
docs: Checks if a node needs to be blacklisted and blacklists it.
  @param nodeName The node name.
  @param faultStats The fault statistics for the node.