use of org.apache.accumulo.server.manager.state.TabletServerState in project accumulo by apache.
the class ManagerResource method getNumBadTservers.
/**
* Generates bad tserver lists as a JSON object
*
* @return bad tserver list
*/
public static BadTabletServers getNumBadTservers(Monitor monitor) {
ManagerMonitorInfo mmi = monitor.getMmi();
if (mmi == null) {
return new BadTabletServers();
}
Map<String, Byte> badServers = mmi.getBadTServers();
if (badServers == null || 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