protected void startGlobalStats(KeycloakSession session, int globalStatsIntervalSecs) { logger.debugf("Started Hibernate statistics with the interval %s seconds", globalStatsIntervalSecs); TimerProvider timer = session.getProvider(TimerProvider.class); timer.scheduleTask(new HibernateStatsReporter(emf), globalStatsIntervalSecs * 1000, "ReportHibernateGlobalStats"); }
protected void setupPeriodicTimer(KeycloakSession kcSession, AbstractLastSessionRefreshStore store, long timerIntervalMs, String eventKey) { TimerProvider timer = kcSession.getProvider(TimerProvider.class); timer.scheduleTask((KeycloakSession keycloakSession) -> { store.checkSendingMessage(keycloakSession, Time.currentTime()); }, timerIntervalMs, eventKey); } }