public void addHostsAndBlockWeight(String[] hosts, long weight, StorageType[] storageTypes) {
    if (hosts == null || hosts.length == 0) {
      // erroneous data
      return;
    }

    addUniqueWeight(weight);
    if (storageTypes != null && storageTypes.length == hosts.length) {
      for (int i = 0; i < hosts.length; i++) {
        long weightForSsd = 0;
        if (storageTypes[i] == StorageType.SSD) {
          weightForSsd = weight;
        }
        addHostAndBlockWeight(hosts[i], weight, weightForSsd);
      }
    } else {
      for (String hostname : hosts) {
        addHostAndBlockWeight(hostname, weight, 0);
      }
    }
  }
add some weight to a list of hosts, update the value of unique block weight
@param hosts  the list of the host
@param weight the weight
hbase-common/src/main/java/org/apache/hadoop/hbase/HDFSBlocksDistribution.java