Search in sources :

Example 1 with EngineCronTrigger

use of org.ovirt.engine.core.common.utils.EngineCronTrigger in project ovirt-engine by oVirt.

the class AuditLogCleanupManager method init.

@PostConstruct
private void init() {
    log.info("Start initializing {}", getClass().getSimpleName());
    Calendar calendar = new GregorianCalendar();
    Date auditLogCleanupTime = Config.<DateTime>getValue(ConfigValues.AuditLogCleanupTime);
    calendar.setTimeInMillis(auditLogCleanupTime.getTime());
    String cronExpression = String.format("%d %d %d * * ?", calendar.get(Calendar.SECOND), calendar.get(Calendar.MINUTE), calendar.get(Calendar.HOUR_OF_DAY));
    log.info("Setting audit cleanup manager to run at '{}'", cronExpression);
    executor.schedule(this::cleanup, new EngineCronTrigger(cronExpression));
    log.info("Finished initializing {}", getClass().getSimpleName());
}
Also used : GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) EngineCronTrigger(org.ovirt.engine.core.common.utils.EngineCronTrigger) Date(java.util.Date) DateTime(org.ovirt.engine.core.compat.DateTime) PostConstruct(javax.annotation.PostConstruct)

Example 2 with EngineCronTrigger

use of org.ovirt.engine.core.common.utils.EngineCronTrigger in project ovirt-engine by oVirt.

the class AutoRecoveryManager method initialize.

/**
 * Should be called by backend, schedules the execution as configured.
 */
@PostConstruct
void initialize() {
    log.info("Start initializing {}", getClass().getSimpleName());
    executor.schedule(this::recover, new EngineCronTrigger(Config.getValue(ConfigValues.AutoRecoverySchedule)));
    log.info("Finished initializing {}", getClass().getSimpleName());
}
Also used : EngineCronTrigger(org.ovirt.engine.core.common.utils.EngineCronTrigger) PostConstruct(javax.annotation.PostConstruct)

Example 3 with EngineCronTrigger

use of org.ovirt.engine.core.common.utils.EngineCronTrigger in project ovirt-engine by oVirt.

the class CommandEntityCleanupManager method init.

@PostConstruct
private void init() {
    log.info("Start initializing {}", getClass().getSimpleName());
    Calendar calendar = new GregorianCalendar();
    Date commandEntityCleanupTime = Config.<DateTime>getValue(ConfigValues.CommandEntityCleanupTime);
    calendar.setTimeInMillis(commandEntityCleanupTime.getTime());
    String cronExpression = String.format("%d %d %d * * ?", calendar.get(Calendar.SECOND), calendar.get(Calendar.MINUTE), calendar.get(Calendar.HOUR_OF_DAY));
    log.info("Setting command entity cleanup manager to run at: {}", cronExpression);
    executor.schedule(this::cleanup, new EngineCronTrigger(cronExpression));
    log.info("Finished initializing {}", getClass().getSimpleName());
}
Also used : GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) EngineCronTrigger(org.ovirt.engine.core.common.utils.EngineCronTrigger) Date(java.util.Date) DateTime(org.ovirt.engine.core.compat.DateTime) PostConstruct(javax.annotation.PostConstruct)

Aggregations

PostConstruct (javax.annotation.PostConstruct)3 EngineCronTrigger (org.ovirt.engine.core.common.utils.EngineCronTrigger)3 Calendar (java.util.Calendar)2 Date (java.util.Date)2 GregorianCalendar (java.util.GregorianCalendar)2 DateTime (org.ovirt.engine.core.compat.DateTime)2