use of org.gluu.service.timer.schedule.TimerSchedule in project oxAuth by GluuFederation.
the class ConfigurationFactory method initTimer.
public void initTimer() {
log.debug("Initializing Configuration Timer");
final int delay = 30;
final int interval = DEFAULT_INTERVAL;
timerEvent.fire(new TimerEvent(new TimerSchedule(delay, interval), new ConfigurationEvent(), Scheduled.Literal.INSTANCE));
}
use of org.gluu.service.timer.schedule.TimerSchedule in project oxAuth by GluuFederation.
the class StatTimer method initTimer.
@Asynchronous
public void initTimer() {
log.info("Initializing Stat Service Timer");
this.isActive = new AtomicBoolean(false);
timerEvent.fire(new TimerEvent(new TimerSchedule(TIMER_TICK_INTERVAL_IN_SECONDS, TIMER_TICK_INTERVAL_IN_SECONDS), new StatEvent(), Scheduled.Literal.INSTANCE));
this.lastFinishedTime = System.currentTimeMillis();
log.info("Initialized Stat Service Timer");
}
use of org.gluu.service.timer.schedule.TimerSchedule in project oxAuth by GluuFederation.
the class CibaRequestsProcessorJob method initTimer.
/**
* Method invoked from the appInitializer to start processing every some time.
*/
public void initTimer() {
log.debug("Initializing CIBA requests processor");
this.isActive = new AtomicBoolean(false);
int intervalSec = appConfiguration.getBackchannelRequestsProcessorJobIntervalSec();
// Schedule to start processor every N seconds
processorEvent.fire(new TimerEvent(new TimerSchedule(intervalSec, intervalSec), new CibaRequestsProcessorEvent(), Scheduled.Literal.INSTANCE));
this.lastFinishedTime = System.currentTimeMillis();
this.executorService = Executors.newCachedThreadPool(ServerUtil.daemonThreadFactory());
}
use of org.gluu.service.timer.schedule.TimerSchedule in project oxCore by GluuFederation.
the class LoggerService method initTimer.
public void initTimer() {
log.info("Initializing Logger Update Timer");
final int delay = 15;
final int interval = DEFAULT_INTERVAL;
timerEvent.fire(new TimerEvent(new TimerSchedule(delay, interval), new LoggerUpdateEvent(), Scheduled.Literal.INSTANCE));
}
use of org.gluu.service.timer.schedule.TimerSchedule in project oxCore by GluuFederation.
the class QuartzSchedulerManager method schedule.
public void schedule(@Observes TimerEvent timerEvent) {
checkInitialized();
JobDataMap dataMap = new JobDataMap();
dataMap.put(TimerJob.KEY_TIMER_EVENT, timerEvent);
String uuid = UUID.randomUUID().toString();
JobDetail timerJob = JobBuilder.newJob(TimerJob.class).withIdentity(TimerJob.class.getSimpleName() + "_" + uuid, TimerJob.TIMER_JOB_GROUP).usingJobData(dataMap).build();
TimerSchedule timerSchedule = timerEvent.getSchedule();
Date triggerStartTime = new Date(System.currentTimeMillis() + timerSchedule.getDelay() * 1000L);
Trigger timerTrigger = TriggerBuilder.newTrigger().withIdentity(uuid, TimerJob.TIMER_JOB_GROUP).startAt(triggerStartTime).withSchedule(SimpleScheduleBuilder.repeatSecondlyForever(timerSchedule.getInterval())).build();
try {
scheduler.scheduleJob(timerJob, timerTrigger);
} catch (SchedulerException ex) {
throw new IllegalStateException("Failed to schedule Timer Event", ex);
}
}
Aggregations