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); 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); timerService.createCalendarTimer(new ScheduleExpression().second("*").minute("*").hour("*"), checkOnTheDaughters);
@PostConstruct public void initialize() { ScheduleExpression scheduleExpression = new ScheduleExpression() .hour("*") .minute("*") .second("*/5"); TimerConfig timerConfig = new TimerConfig(); timerConfig.setInfo("Every 5 second timer"); timerService.createCalendarTimer(scheduleExpression, timerConfig); }
public ScheduleExpression getScheduleExpression() { if (this.scheduleExpression == null) { this.scheduleExpression = new ScheduleExpression(); this.scheduleExpression.second(this.scheduleExprSecond).minute(this.scheduleExprMinute).hour(this.scheduleExprHour).dayOfWeek(this.scheduleExprDayOfWeek) .dayOfMonth(this.scheduleExprDayOfMonth).month(this.scheduleExprMonth).year(this.scheduleExprYear).timezone(this.scheduleExprTimezone) .start(this.scheduleExprStartDate).end(this.scheduleExprEndDate); } return scheduleExpression; }
ScheduleExpression s = new ScheduleExpression(); s.second(builder.scheduleExprSecond); s.minute(builder.scheduleExprMinute);
private ScheduleExpression clone(ScheduleExpression schedule) { // clone the schedule ScheduleExpression clonedSchedule = new ScheduleExpression(); clonedSchedule.second(schedule.getSecond()); clonedSchedule.minute(schedule.getMinute()); clonedSchedule.hour(schedule.getHour()); clonedSchedule.dayOfWeek(schedule.getDayOfWeek()); clonedSchedule.dayOfMonth(schedule.getDayOfMonth()); clonedSchedule.month(schedule.getMonth()); clonedSchedule.year(schedule.getYear()); clonedSchedule.timezone(schedule.getTimezone()); clonedSchedule.start(schedule.getStart()); clonedSchedule.end(schedule.getEnd()); return clonedSchedule; }
@Singleton @Startup public class TimedBean{ @Resource private TimerService service; @PostConstruct public void init(){ ScheduleExpression exp=new ScheduleExpression(); exp.hour("*") .minute("*") .second("*/10"); service.createCalendarTimer(exp); } @Timeout public void timeOut(){ System.out.println(new Date()); System.out.println("time out"); } }
ScheduleExpression exp; exp = new ScheduleExpression().minute(0).second(0); exp.dayOfWeek("mon-sat").hour("9,11,13,15,17"); service.createCalendarTime(exp); exp = new ScheduleExpression().minute(0).second(0); exp.dayOfWeek("fri").hour("9-14"); service.createCalendarTime(exp); exp = new ScheduleExpression().minute(0).second(0); exp.dayOfWeek("sat").hour("9,11,13"); service.createCalendarTime(exp);
ScheduleExpression schedule = new ScheduleExpression(); schedule.hour(hourProperty);//previously read property from .properties file schedule.minute(minuteProperty);//previously read property from .properties file Timer timer = timerService.createCalendarTimer(schedule);
ScheduleExpression schedule = new ScheduleExpression(); schedule.dayOfWeek("[0,7]"); schedule.hour("05"); Timer timer = timerService.createCalendarTimer(schedule);
@PostConstruct public void init() { timerService.createCalendarTimer(new ScheduleExpression().second("*/1") .minute("*").hour("*")); }
ScheduleExpression schedule = new ScheduleExpression(); schedule.start(startDate); schedule.hour("*/2"); schedule.end(endDate); Timer timer = timerService.createCalendarTimer(schedule);
synchronized public void startTimer() { ScheduleExpression schedule = new ScheduleExpression(); if (null == timezone) { log.warning("Timezone not set, using default: America/Sao_Paulo"); schedule.timezone("America/Sao_Paulo"); } else { schedule.timezone(timezone); } schedule.hour("23"); schedule.minute("00"); timerService.createCalendarTimer(schedule); }
@PostConstruct public void configure() { if (DeploymentSynchronizer.DEPLOY_SYNC_ENABLED) { ScheduleExpression schedule = new ScheduleExpression(); schedule.hour("*"); schedule.minute("*"); schedule.second("*/" + DeploymentSynchronizer.DEPLOY_SYNC_INTERVAL); timer = timerService.createCalendarTimer(schedule, new TimerConfig(null, false)); } }
public void createCustomer(Customer04 customer) { em.persist(customer); ScheduleExpression birthDay = new ScheduleExpression().dayOfMonth(customer.getBirthDay()).month(customer.getBirthMonth()); timerService.createCalendarTimer(birthDay, new TimerConfig(customer, true)); }
public void register(final String clientId) { sendMessage(REGISTER_ENDPOINT, applicationConfig.toJSON()); ScheduleExpression schedule = new ScheduleExpression(); schedule.second("*/10").minute("*").hour("*").start(Calendar.getInstance().getTime()); TimerConfig config = new TimerConfig(); config.setPersistent(false); Timer timer = timerService.createCalendarTimer(schedule, config); LOGGER.config(() -> timer.getSchedule().toString()); }
public void register(final String clientId) { sendMessage(REGISTER_ENDPOINT, applicationConfig.toJSON()); ScheduleExpression schedule = new ScheduleExpression(); schedule.second("*/10").minute("*").hour("*").start(Calendar.getInstance().getTime()); TimerConfig config = new TimerConfig(); config.setPersistent(false); Timer timer = timerService.createCalendarTimer(schedule, config); LOGGER.config(() -> timer.getSchedule().toString()); }
@PostConstruct public void configure() { DeploymentStore store = new DeploymentStore(); store.setCommandService(commandService); setDeploymentStore(store); if (DEPLOY_SYNC_ENABLED) { ScheduleExpression schedule = new ScheduleExpression(); schedule.hour("*"); schedule.minute("*"); schedule.second("*/" + DEPLOY_SYNC_INTERVAL); timer = timerService.createCalendarTimer(schedule, new TimerConfig(null, false)); } }
public ScheduleExpression getScheduleExpression() { return new ScheduleExpression(). second(second_). minute(minute_). hour(hour_). dayOfMonth(dayOfMonth_). month(month_). dayOfWeek(dayOfWeek_). year(year_). timezone(timezone_). start(start_). end(end_); }
public ScheduleExpression getScheduleExpression() { if (this.scheduleExpression == null) { this.scheduleExpression = new ScheduleExpression(); this.scheduleExpression.second(this.scheduleExprSecond).minute(this.scheduleExprMinute).hour(this.scheduleExprHour).dayOfWeek(this.scheduleExprDayOfWeek) .dayOfMonth(this.scheduleExprDayOfMonth).month(this.scheduleExprMonth).year(this.scheduleExprYear).timezone(this.scheduleExprTimezone) .start(this.scheduleExprStartDate).end(this.scheduleExprEndDate); } return scheduleExpression; }
public ScheduleExpression getScheduleExpression() { return new ScheduleExpression(). second(getSecond()). minute(getMinute()). hour(getHour()). dayOfMonth(getDayOfMonth()). month(getMonth()). dayOfWeek(getDayOfWeek()). year(getYear()). timezone(getTimeZoneID()). start(getStart()). end(getEnd()); }