use of org.apache.accumulo.monitor.rest.tservers.BadTabletServerInformation in project accumulo by apache.
the class MasterResource method getNumBadTservers.
/**
* Generates bad tserver lists as a JSON object
*
* @return bad tserver list
*/
public static BadTabletServers getNumBadTservers() {
MasterMonitorInfo mmi = getMmi();
if (null == mmi) {
return new BadTabletServers();
}
Map<String, Byte> badServers = mmi.getBadTServers();
if (null == badServers || badServers.isEmpty()) {
return new BadTabletServers();
}
BadTabletServers readableBadServers = new BadTabletServers();
// Add new bad tservers to the list
for (Entry<String, Byte> badServer : badServers.entrySet()) {
try {
TabletServerState state = TabletServerState.getStateById(badServer.getValue());
readableBadServers.addBadServer(new BadTabletServerInformation(badServer.getKey(), state.name()));
} catch (IndexOutOfBoundsException e) {
readableBadServers.addBadServer(new BadTabletServerInformation(badServer.getKey(), "Unknown state"));
}
}
return readableBadServers;
}
Aggregations