Search in sources :

Example 1 with TimerConfig

use of jakarta.ejb.TimerConfig in project tomee by apache.

the class FarmerBrown method construct.

@PostConstruct
private void construct() {
    final TimerConfig plantTheCorn = new TimerConfig("plantTheCorn", false);
    timerService.createCalendarTimer(new ScheduleExpression().month(5).dayOfMonth("20-Last").minute(0).hour(8), plantTheCorn);
    timerService.createCalendarTimer(new ScheduleExpression().month(6).dayOfMonth("1-10").minute(0).hour(8), plantTheCorn);
    final TimerConfig harvestTheCorn = new TimerConfig("harvestTheCorn", false);
    timerService.createCalendarTimer(new ScheduleExpression().month(9).dayOfMonth("20-Last").minute(0).hour(8), harvestTheCorn);
    timerService.createCalendarTimer(new ScheduleExpression().month(10).dayOfMonth("1-10").minute(0).hour(8), harvestTheCorn);
    final TimerConfig checkOnTheDaughters = new TimerConfig("checkOnTheDaughters", false);
    timerService.createCalendarTimer(new ScheduleExpression().second("*").minute("*").hour("*"), checkOnTheDaughters);
}
Also used : ScheduleExpression(jakarta.ejb.ScheduleExpression) TimerConfig(jakarta.ejb.TimerConfig) PostConstruct(jakarta.annotation.PostConstruct)

Example 2 with TimerConfig

use of jakarta.ejb.TimerConfig in project cdi-tck by jakartaee.

the class TimeoutService method start.

public void start() {
    TimerConfig config = new TimerConfig();
    config.setPersistent(false);
    timerService.createSingleActionTimer(100, config);
}
Also used : TimerConfig(jakarta.ejb.TimerConfig)

Example 3 with TimerConfig

use of jakarta.ejb.TimerConfig in project tomee by apache.

the class MethodScheduleBuilder method addSchedulesToMethod.

private void addSchedulesToMethod(final MethodContext methodContext, final MethodScheduleInfo info) {
    if (methodContext == null) {
        return;
    }
    for (final ScheduleInfo scheduleInfo : info.schedules) {
        final ScheduleExpression expr = new ScheduleExpression();
        expr.second(scheduleInfo.second == null ? "0" : scheduleInfo.second);
        expr.minute(scheduleInfo.minute == null ? "0" : scheduleInfo.minute);
        expr.hour(scheduleInfo.hour == null ? "0" : scheduleInfo.hour);
        expr.dayOfWeek(scheduleInfo.dayOfWeek == null ? "*" : scheduleInfo.dayOfWeek);
        expr.dayOfMonth(scheduleInfo.dayOfMonth == null ? "*" : scheduleInfo.dayOfMonth);
        expr.month(scheduleInfo.month == null ? "*" : scheduleInfo.month);
        expr.year(scheduleInfo.year == null ? "*" : scheduleInfo.year);
        expr.timezone(scheduleInfo.timezone);
        expr.start(scheduleInfo.start);
        expr.end(scheduleInfo.end);
        final TimerConfig config = new TimerConfig();
        config.setInfo(scheduleInfo.info);
        config.setPersistent(scheduleInfo.persistent);
        methodContext.getSchedules().add(new ScheduleData(config, expr));
    }
}
Also used : ScheduleExpression(jakarta.ejb.ScheduleExpression) ScheduleData(org.apache.openejb.core.timer.ScheduleData) TimerConfig(jakarta.ejb.TimerConfig)

Example 4 with TimerConfig

use of jakarta.ejb.TimerConfig in project cdi-tck by eclipse-ee4j.

the class TimeoutService method start.

public void start() {
    TimerConfig config = new TimerConfig();
    config.setPersistent(false);
    timerService.createSingleActionTimer(100, config);
}
Also used : TimerConfig(jakarta.ejb.TimerConfig)

Aggregations

TimerConfig (jakarta.ejb.TimerConfig)4 ScheduleExpression (jakarta.ejb.ScheduleExpression)2 PostConstruct (jakarta.annotation.PostConstruct)1 ScheduleData (org.apache.openejb.core.timer.ScheduleData)1