use of password.pwm.svc.cluster.NodeInfo in project pwm by pwm-project.
the class AppDashboardData method makeNodeData.
private static List<NodeData> makeNodeData(final PwmApplication pwmApplication, final Locale locale) {
if (pwmApplication.getClusterService().status() != PwmService.STATUS.OPEN) {
return Collections.emptyList();
}
final String notApplicable = Display.getLocalizedMessage(locale, Display.Value_NotApplicable, pwmApplication.getConfig());
final List<NodeData> nodeData = new ArrayList<>();
try {
for (final NodeInfo nodeInfo : pwmApplication.getClusterService().nodes()) {
final String uptime = nodeInfo.getStartupTime() == null ? notApplicable : TimeDuration.fromCurrent(nodeInfo.getStartupTime()).asLongString(locale);
nodeData.add(new NodeData(nodeInfo.getInstanceID(), uptime, JavaHelper.toIsoDate(nodeInfo.getLastSeen()), nodeInfo.getNodeState(), nodeInfo.isConfigMatch()));
}
} catch (PwmUnrecoverableException e) {
LOGGER.trace("error building AppDashboardData node-state: " + e.getMessage());
}
return Collections.unmodifiableList(nodeData);
}
Aggregations