* Simply get the HealthHistory object from GMSAdapter and output
* the information.
*/
private void getHealthWithGMS(Logger logger, ActionReport report, GMSAdapter gmsAdapter) {
StringBuilder result = new StringBuilder();
HealthHistory history = gmsAdapter.getHealthHistory();
if (history == null) {
setFail(logger, report, Strings.get("get.health.noHistoryError"));
return;
}
// check for data
if (history.getInstances().isEmpty()) {
report.setMessage(Strings.get(
"get.health.no.instances", clusterName));
return;
}
// order by instance name for human-readable output
SortedSet<String> names = new TreeSet<String>(history.getInstances());
// this list will be set in the "extra properties" used by admin console
List<Properties> statesAndTimes =
new ArrayList<Properties>(names.size());
for(String name : names) {
Properties instanceStateAndTime = new Properties();
HealthHistory.InstanceHealth ih = history.getHealthByInstance(name);
instanceStateAndTime.put("name", name);
instanceStateAndTime.put("status", ih.state.name());
if (HealthHistory.NOTIME == ih.time) {