Search in sources :

Example 1 with HistoricHealthCheckEvent

use of fish.payara.nucleus.healthcheck.HistoricHealthCheckEvent in project Payara by payara.

the class ListHistoricHealthChecks method generateReport.

private void generateReport(ActionReport actionReport) {
    if (first == null) {
        first = service.getHistoricalTraceStoreSize();
    }
    HistoricHealthCheckEvent[] traces = eventStore.getTraces(first);
    ColumnFormatter columnFormatter = new ColumnFormatter(headers);
    Properties extrasProps = new Properties();
    List historic = new ArrayList<>();
    if (traces != null) {
        for (HistoricHealthCheckEvent historicHealthCheckEvent : traces) {
            LinkedHashMap<String, String> messages = new LinkedHashMap<String, String>();
            Object[] values = new Object[2];
            values[0] = new Date(historicHealthCheckEvent.getOccurringTime());
            values[1] = constructMessage(historicHealthCheckEvent);
            messages.put("dateTime", values[0].toString());
            messages.put("message", (String) values[1]);
            historic.add(messages);
            columnFormatter.addRow(values);
        }
    }
    actionReport.setMessage(columnFormatter.toString());
    extrasProps.put("historicmessages", historic);
    actionReport.setExtraProperties(extrasProps);
    actionReport.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
Also used : HistoricHealthCheckEvent(fish.payara.nucleus.healthcheck.HistoricHealthCheckEvent) ColumnFormatter(com.sun.enterprise.util.ColumnFormatter)

Aggregations

ColumnFormatter (com.sun.enterprise.util.ColumnFormatter)1 HistoricHealthCheckEvent (fish.payara.nucleus.healthcheck.HistoricHealthCheckEvent)1