use of won.bot.framework.eventbot.bus.impl.EventBusStatistics in project webofneeds by researchstudio-sat.
the class StatisticsLoggingAction method doRun.
@Override
protected void doRun(Event event, EventListener executingListener) throws Exception {
EventBus bus = getEventListenerContext().getEventBus();
EventBusStatistics statistics = bus.generateEventBusStatistics();
StringBuilder sb = new StringBuilder();
sb.append("\nEvent bus statistics: \n").append("number of listeners: ").append(statistics.getListenerCount()).append("\n").append("number of listeners per listener class:\n");
statistics.getListenerCountPerListenerClass().entrySet().stream().sorted((e1, e2) -> e1.getKey().getName().compareTo(e2.getKey().getName())).forEach(e -> sb.append(e.getKey().getName()).append(": ").append(e.getValue()).append("\n"));
sb.append("number of listeners per event class:\n");
statistics.getListenerCountPerEvent().entrySet().stream().sorted((e1, e2) -> e1.getKey().getName().compareTo(e2.getKey().getName())).forEach(e -> sb.append(e.getKey()).append(": ").append(e.getValue()).append("\n"));
logger.info(sb.toString());
}
Aggregations