}
private void balanceLoggers() {
List<LoggerUser> logUsers = new ArrayList<LoggerUser>();
for (Entry<TServerInstance,TabletServerStatus> entry : tserverStatus.entrySet()) {
logUsers.add(new TServerUsesLoggers(entry.getKey(), entry.getValue()));
}
List<String> logNames = new ArrayList<String>(loggers.getLoggersFromZooKeeper().values());
Map<LoggerUser,List<String>> assignmentsOut = new HashMap<LoggerUser,List<String>>();
int loggersPerServer = AccumuloConfiguration.getSystemConfiguration().getCount(Property.TSERV_LOGGER_COUNT);
loggerBalancer.balance(logUsers, logNames, assignmentsOut, loggersPerServer);
for (Entry<LoggerUser,List<String>> entry : assignmentsOut.entrySet()) {
TServerUsesLoggers tserver = (TServerUsesLoggers) entry.getKey();
try {
log.debug("Telling " + tserver.getInstance() + " to use loggers " + entry.getValue());
TServerConnection connection = tserverSet.getConnection(tserver.getInstance());
if (connection != null)
connection.useLoggers(new HashSet<String>(entry.getValue()));
} catch (Exception ex) {
log.warn("Unable to talk to " + tserver.getInstance(), ex);
}
}
}