Thomas Vachuska

Adding ability to balance load between different cell servers.

Adding ability to specify structure/size of the cell.

Change-Id: I2b721dac187cc1a73be2949bdb71709ad72cbb48
......@@ -216,7 +216,7 @@ class Warden {
new ServerInfo(info.hostName) : v.bumpLoad(info)));
List<ServerInfo> servers = new ArrayList<>(load.values());
servers.sort((a, b) -> a.load - b.load);
servers.sort((a, b) -> b.load - a.load);
ServerInfo server = servers.get(0);
return server.cells.get(random.nextInt(server.cells.size())).cellName;
}
......
......@@ -85,9 +85,9 @@ public class WardenTest {
validateCellState(doltCell);
validateSizes(4, 2);
assertTrue("cells should not be on the same host",
Objects.equals(warden.getCellHost(dudeCell.cellName),
warden.getCellHost(doltCell.cellName)));
assertFalse("cells should not be on the same host",
Objects.equals(warden.getCellHost(dudeCell.cellName),
warden.getCellHost(doltCell.cellName)));
warden.returnCell("dude");
validateSizes(5, 1);
......