use of org.apache.hadoop.hbase.rsgroup.RSGroupInfo in project hbase by apache.
the class TestRSGroupBasedLoadBalancer method constructGroupInfo.
/**
* Construct group info, with each group having at least one server.
*
* @param servers the servers
* @param groups the groups
* @return the map
*/
private static Map<String, RSGroupInfo> constructGroupInfo(List<ServerName> servers, String[] groups) {
assertTrue(servers != null);
assertTrue(servers.size() >= groups.length);
int index = 0;
Map<String, RSGroupInfo> groupMap = new HashMap<>();
for (String grpName : groups) {
RSGroupInfo RSGroupInfo = new RSGroupInfo(grpName);
RSGroupInfo.addServer(servers.get(index).getAddress());
groupMap.put(grpName, RSGroupInfo);
index++;
}
while (index < servers.size()) {
int grpIndex = rand.nextInt(groups.length);
groupMap.get(groups[grpIndex]).addServer(servers.get(index).getAddress());
index++;
}
return groupMap;
}
Aggregations