Search in sources :

Example 6 with TimerSchedule

use of org.xdi.service.timer.schedule.TimerSchedule in project oxTrust 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));
}
Also used : ConfigurationEvent(org.xdi.service.cdi.event.ConfigurationEvent) TimerSchedule(org.xdi.service.timer.schedule.TimerSchedule) TimerEvent(org.xdi.service.timer.event.TimerEvent)

Example 7 with TimerSchedule

use of org.xdi.service.timer.schedule.TimerSchedule in project oxTrust by GluuFederation.

the class LdapStatusTimer method initTimer.

public void initTimer() {
    log.info("Initializing Ldap Status Timer");
    this.isActive = new AtomicBoolean(false);
    timerEvent.fire(new TimerEvent(new TimerSchedule(DEFAULT_INTERVAL, DEFAULT_INTERVAL), new LdapStatusEvent(), Scheduled.Literal.INSTANCE));
}
Also used : LdapStatusEvent(org.xdi.service.cdi.event.LdapStatusEvent) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TimerSchedule(org.xdi.service.timer.schedule.TimerSchedule) TimerEvent(org.xdi.service.timer.event.TimerEvent)

Example 8 with TimerSchedule

use of org.xdi.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);
    }
}
Also used : JobDataMap(org.quartz.JobDataMap) JobDetail(org.quartz.JobDetail) TimerSchedule(org.xdi.service.timer.schedule.TimerSchedule) Trigger(org.quartz.Trigger) SchedulerException(org.quartz.SchedulerException) Date(java.util.Date)

Example 9 with TimerSchedule

use of org.xdi.service.timer.schedule.TimerSchedule in project oxTrust by GluuFederation.

the class LogDir method initTimer.

public void initTimer() {
    log.info("Initializing Log File Size Checker Timer");
    this.isActive = new AtomicBoolean(false);
    final int delay = 2 * 60;
    final int interval = DEFAULT_INTERVAL;
    timerEvent.fire(new TimerEvent(new TimerSchedule(delay, interval), new LogFileSizeChekerEvent(), Scheduled.Literal.INSTANCE));
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TimerSchedule(org.xdi.service.timer.schedule.TimerSchedule) LogFileSizeChekerEvent(org.gluu.oxtrust.service.cdi.event.LogFileSizeChekerEvent) TimerEvent(org.xdi.service.timer.event.TimerEvent)

Example 10 with TimerSchedule

use of org.xdi.service.timer.schedule.TimerSchedule in project oxTrust by GluuFederation.

the class StatusCheckerDaily method initTimer.

public void initTimer() {
    log.info("Initializing Daily Status Cheker Timer");
    this.isActive = new AtomicBoolean(false);
    final int delay = 1 * 60;
    final int interval = DEFAULT_INTERVAL;
    timerEvent.fire(new TimerEvent(new TimerSchedule(delay, interval), new StatusCheckerDailyEvent(), Scheduled.Literal.INSTANCE));
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TimerSchedule(org.xdi.service.timer.schedule.TimerSchedule) StatusCheckerDailyEvent(org.gluu.oxtrust.service.cdi.event.StatusCheckerDailyEvent) TimerEvent(org.xdi.service.timer.event.TimerEvent)

Aggregations

TimerSchedule (org.xdi.service.timer.schedule.TimerSchedule)16 TimerEvent (org.xdi.service.timer.event.TimerEvent)15 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)11 ConfigurationEvent (org.xdi.service.cdi.event.ConfigurationEvent)2 LdapStatusEvent (org.xdi.service.cdi.event.LdapStatusEvent)2 Date (java.util.Date)1 CacheRefreshEvent (org.gluu.oxtrust.service.cdi.event.CacheRefreshEvent)1 EntityIdMonitoringEvent (org.gluu.oxtrust.service.cdi.event.EntityIdMonitoringEvent)1 LogFileSizeChekerEvent (org.gluu.oxtrust.service.cdi.event.LogFileSizeChekerEvent)1 MetadataValidationEvent (org.gluu.oxtrust.service.cdi.event.MetadataValidationEvent)1 StatusCheckerDailyEvent (org.gluu.oxtrust.service.cdi.event.StatusCheckerDailyEvent)1 StatusCheckerTimerEvent (org.gluu.oxtrust.service.cdi.event.StatusCheckerTimerEvent)1 SvnSyncEvent (org.gluu.oxtrust.service.cdi.event.SvnSyncEvent)1 JobDataMap (org.quartz.JobDataMap)1 JobDetail (org.quartz.JobDetail)1 SchedulerException (org.quartz.SchedulerException)1 Trigger (org.quartz.Trigger)1 CacheRefreshConfiguration (org.xdi.config.oxtrust.CacheRefreshConfiguration)1 CleanerEvent (org.xdi.oxauth.service.cdi.event.CleanerEvent)1 KeyGenerationEvent (org.xdi.oxauth.service.cdi.event.KeyGenerationEvent)1