final Collection<Timer> timers = new HashSet<>();
for (final BeanContext c : module.getAppContext().getBeanContexts()) {
if (c.getModuleContext() == module) { // filter by module
if (c.getComponentType() != BeanType.STATEFUL) {
final TimerService timerService = getTimerService(null, c, true);
if (timerService == null) {
continue;
}
final Collection<Timer> beanTimers = timerService.getTimers();
timers.addAll(beanTimers);
} else {
// for all instances
final TimerService timerService = getTimerService(null, c, true);
if (timerService == null) {
continue;
}
final Collection<Timer> beanTimers = timerService.getTimers();
timers.addAll(beanTimers);
}
}
}
return timers;