docs: private void determinePartitionLeaders(Map<Integer, Host> hostLeaderMap){
          if (hostLeaderMap.isEmpty() || m_callbacks.isEmpty()) {
              return;
          }
          tmLog.info(WHOMIM + "Recalculate partition leaders after node down is detected.");
          // iterate through all partitions to see if its current leaders are on the failed hosts.
          for (PartitionCallback cb : m_callbacks.values()) {
              SortedSet<Host> hosts = new TreeSet<Host>();
              hosts.addAll(hostLeaderMap.values());
              int hostId = CoreUtils.getHostIdFromHSId(cb.m_currentLeader);
              //This partition has a valid leader
              if (hostLeaderMap.containsKey(hostId)) {
                  continue;
              }
              for (Host host : hosts) {
                  //The host does not have a replica of this partition
                  if (!(host.partitions.contains(cb.m_partitionId))) {
                      continue;
                  }
  
                  //find the host which has the lowest leader count.
                  host.increasePartitionLeader();
                  cb.newLeaderHostId = host.id;
                  if (tmLog.isDebugEnabled()) {
                      tmLog.debug(WHOMIM + String.format("Move partition leader to host %d from %d for partition %d.",
                              host.id, hostId, cb.m_partitionId));
                  }
                  break;
              }
          }
      }