@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); }
@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"); } }
public Timer createCalendarTimer(ScheduleExpression schedule) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createCalendarTimer"); return timerService.createCalendarTimer(schedule); }
public Timer createCalendarTimer(ScheduleExpression schedule) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createCalendarTimer"); return timerService.createCalendarTimer(schedule); }
public Timer createCalendarTimer(ScheduleExpression schedule, TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createCalendarTimer"); return timerService.createCalendarTimer(schedule, timerConfig); }
public Timer createCalendarTimer(ScheduleExpression schedule) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createCalendarTimer"); return delegate.createCalendarTimer(schedule); }
public Timer createCalendarTimer(ScheduleExpression schedule) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createCalendarTimer"); return timerService.createCalendarTimer(schedule); }
public Timer createCalendarTimer(ScheduleExpression schedule, TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createCalendarTimer"); return timerService.createCalendarTimer(schedule, timerConfig); }
public Timer createCalendarTimer(ScheduleExpression schedule, TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createCalendarTimer"); return timerService.createCalendarTimer(schedule, timerConfig); }
public Timer createCalendarTimer(ScheduleExpression schedule, TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createCalendarTimer"); return delegate.createCalendarTimer(schedule, timerConfig); }
public Timer createCalendarTimer(final ScheduleExpression scheduleExpression, final TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { return getTimerService().createCalendarTimer(scheduleExpression, timerConfig); }
public Timer createCalendarTimer(final ScheduleExpression scheduleExpression) throws IllegalArgumentException, IllegalStateException, EJBException { return getTimerService().createCalendarTimer(scheduleExpression); }
@PostConstruct public void init() { timerService.createCalendarTimer(new ScheduleExpression().second("*/1") .minute("*").hour("*")); }
/** * Schedule a job for regular execution. * <p/> * @param job * @param when The ScheduleExpression dictating when the job should be run. */ public void scheduleJobOnCalendar(Jobs job, ScheduleExpression when) { TimerConfig config = new TimerConfig(); config.setInfo(job.getId()); timerService.createCalendarTimer(when, config); }
@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)); } }
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); }
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)); } }