if (!isEnabled()) {
enabled = true;
timer = Executors.newScheduledThreadPool(4);
log.info("(Re)scheduling timer tasks");
for (Retriever curRetriever : retrievers) {
ServiceConfiguration config = curRetriever.getClass()
.getAnnotation(ServiceConfiguration.class);
if (config.runInRandomMode()
|| application.getMode() == DashboardMode.LiveData) {
timer.scheduleWithFixedDelay(new TimerTask(curRetriever),
0, config.interval(), config.unit());
}
}
}
}