org.quartz.DateBuilder.IntervalUnit Java Examples
The following examples show how to use
org.quartz.DateBuilder.IntervalUnit.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QuartzService.java From springbootquartzs with MIT License | 6 votes |
/** * 增加一个job * * @param jobClass * 任务实现类 * @param jobName * 任务名称(建议唯一) * @param jobGroupName * 任务组名 * @param jobTime * 时间表达式 (如:0/5 * * * * ? ) * @param jobData * 参数 */ public void addJob(Class<? extends QuartzJobBean> jobClass, String jobName, String jobGroupName, String jobTime, Map jobData) { try { // 创建jobDetail实例,绑定Job实现类 // 指明job的名称,所在组的名称,以及绑定job类 // 任务名称和组构成任务key JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(jobName, jobGroupName) .build(); // 设置job参数 if(jobData!= null && jobData.size()>0){ jobDetail.getJobDataMap().putAll(jobData); } // 定义调度触发规则 // 使用cornTrigger规则 // 触发器key Trigger trigger = TriggerBuilder.newTrigger().withIdentity(jobName, jobGroupName) .startAt(DateBuilder.futureDate(1, IntervalUnit.SECOND)) .withSchedule(CronScheduleBuilder.cronSchedule(jobTime)).startNow().build(); // 把作业和触发器注册到任务调度中 scheduler.scheduleJob(jobDetail, trigger); } catch (Exception e) { e.printStackTrace(); } }
Example #2
Source File: QuartzManager.java From yyblog with MIT License | 6 votes |
/** * 添加任务 * * @param scheduleJob * @throws SchedulerException */ @SuppressWarnings("unchecked") public void addJob(TaskDO task) { try { // 创建jobDetail实例,绑定Job实现类 // 指明job的名称,所在组的名称,以及绑定job类 Class<? extends Job> jobClass = (Class<? extends Job>) (Class.forName(task.getBeanClass()).newInstance() .getClass()); JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(task.getJobName(), task.getJobGroup())// 任务名称和组构成任务key .build(); // 定义调度触发规则 // 使用cornTrigger规则 Trigger trigger = TriggerBuilder.newTrigger().withIdentity(task.getJobName(), task.getJobGroup())// 触发器key .startAt(DateBuilder.futureDate(1, IntervalUnit.SECOND)) .withSchedule(CronScheduleBuilder.cronSchedule(task.getCronExpression())).startNow().build(); // 把作业和触发器注册到任务调度中 scheduler.scheduleJob(jobDetail, trigger); // 启动 if (!scheduler.isShutdown()) { scheduler.start(); } } catch (Exception e) { e.printStackTrace(); } }
Example #3
Source File: QuartzService.java From springbootquartzs with MIT License | 6 votes |
/** * 增加一个job * * @param jobClass * 任务实现类 * @param jobName * 任务名称(建议唯一) * @param jobGroupName * 任务组名 * @param jobTime * 时间表达式 (如:0/5 * * * * ? ) * @param jobData * 参数 */ public void addJob(Class<? extends QuartzJobBean> jobClass, String jobName, String jobGroupName, String jobTime, Map jobData) { try { // 创建jobDetail实例,绑定Job实现类 // 指明job的名称,所在组的名称,以及绑定job类 // 任务名称和组构成任务key JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(jobName, jobGroupName) .build(); // 设置job参数 if(jobData!= null && jobData.size()>0){ jobDetail.getJobDataMap().putAll(jobData); } // 定义调度触发规则 // 使用cornTrigger规则 // 触发器key Trigger trigger = TriggerBuilder.newTrigger().withIdentity(jobName, jobGroupName) .startAt(DateBuilder.futureDate(1, IntervalUnit.SECOND)) .withSchedule(CronScheduleBuilder.cronSchedule(jobTime)).startNow().build(); // 把作业和触发器注册到任务调度中 scheduler.scheduleJob(jobDetail, trigger); } catch (Exception e) { e.printStackTrace(); } }
Example #4
Source File: CalendarIntervalTriggerPersistenceDelegate.java From lams with GNU General Public License v2.0 | 6 votes |
@Override protected TriggerPropertyBundle getTriggerPropertyBundle(SimplePropertiesTriggerProperties props) { TimeZone tz = null; // if we use null, that's ok as system default tz will be used String tzId = props.getString2(); if(tzId != null && tzId.trim().length() != 0) // there could be null entries from previously released versions tz = TimeZone.getTimeZone(tzId); ScheduleBuilder<?> sb = CalendarIntervalScheduleBuilder.calendarIntervalSchedule() .withInterval(props.getInt1(), IntervalUnit.valueOf(props.getString1())) .inTimeZone(tz) .preserveHourOfDayAcrossDaylightSavings(props.isBoolean1()) .skipDayIfHourDoesNotExist(props.isBoolean2()); int timesTriggered = props.getInt2(); String[] statePropertyNames = { "timesTriggered" }; Object[] statePropertyValues = { timesTriggered }; return new TriggerPropertyBundle(sb, statePropertyNames, statePropertyValues); }
Example #5
Source File: CalDavLoaderImpl.java From openhab1-addons with Eclipse Public License 2.0 | 5 votes |
public void startLoading() { if (execService != null) { return; } log.trace("starting execution..."); int i = 0; for (final CalendarRuntime eventRuntime : EventStorage.getInstance().getEventCache().values()) { try { JobDetail job = JobBuilder.newJob().ofType(EventReloaderJob.class) .usingJobData(EventReloaderJob.KEY_CONFIG, eventRuntime.getConfig().getKey()) .withIdentity(eventRuntime.getConfig().getKey(), JOB_NAME_EVENT_RELOADER).storeDurably() .build(); this.scheduler.addJob(job, false); SimpleTrigger jobTrigger = TriggerBuilder.newTrigger().forJob(job) .withIdentity(eventRuntime.getConfig().getKey(), JOB_NAME_EVENT_RELOADER) .startAt(DateBuilder.futureDate(10 + i, IntervalUnit.SECOND)).withSchedule(SimpleScheduleBuilder .repeatMinutelyForever(eventRuntime.getConfig().getReloadMinutes())) .build(); this.scheduler.scheduleJob(jobTrigger); log.info("reload job scheduled for: {}", eventRuntime.getConfig().getKey()); } catch (SchedulerException e) { log.warn("Cannot schedule calendar reloader", e); } // next event 10 seconds later i += 10; } }
Example #6
Source File: OrientQuartzJdbcIT.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@SuppressWarnings("java:S2699") // sonar doesn't detect awaitility assertions https://jira.sonarsource.com/browse/SONARJAVA-3334 @Test public void test() throws Exception { MyJobListener listener = new MyJobListener("foobar"); JobDetail jobDetail = newJob(SimpleJob.class) .withIdentity(SIMPLE_JOB, Scheduler.DEFAULT_GROUP) .usingJobData("foo", "bar") .build(); Date startTime = DateBuilder.futureDate(3, IntervalUnit.SECOND); Trigger trigger = newTrigger() .withIdentity("SimpleSimpleTrigger", Scheduler.DEFAULT_GROUP) .startAt(startTime) .build(); scheduler.getListenerManager().addJobListener(listener, NameMatcher.jobNameEquals(SIMPLE_JOB)); scheduler.scheduleJob(jobDetail, trigger); await().atMost(1, TimeUnit.SECONDS).until(this::getJobDetail, notNullValue()); await().atMost(1, TimeUnit.SECONDS).until(this::getFooJobData, equalTo("bar")); await().atMost(1, TimeUnit.SECONDS).until(this::getTriggersOfJob, not(empty())); await().atMost(4, TimeUnit.SECONDS).until(listener::isDone, equalTo(true)); await().atMost(1, TimeUnit.SECONDS).until(this::getTriggersOfJob, empty()); }
Example #7
Source File: DailyTimeIntervalTriggerImpl.java From lams with GNU General Public License v2.0 | 5 votes |
/** * <p> * Validates whether the properties of the <code>JobDetail</code> are * valid for submission into a <code>Scheduler</code>. * * @throws IllegalStateException * if a required property (such as Name, Group, Class) is not * set. */ @Override public void validate() throws SchedulerException { super.validate(); if (repeatIntervalUnit == null || !(repeatIntervalUnit.equals(IntervalUnit.SECOND) || repeatIntervalUnit.equals(IntervalUnit.MINUTE) ||repeatIntervalUnit.equals(IntervalUnit.HOUR))) throw new SchedulerException("Invalid repeat IntervalUnit (must be SECOND, MINUTE or HOUR)."); if (repeatInterval < 1) { throw new SchedulerException("Repeat Interval cannot be zero."); } // Ensure interval does not exceed 24 hours long secondsInHour = 24 * 60 * 60L; if (repeatIntervalUnit == IntervalUnit.SECOND && repeatInterval > secondsInHour) { throw new SchedulerException("repeatInterval can not exceed 24 hours (" + secondsInHour + " seconds). Given " + repeatInterval); } if (repeatIntervalUnit == IntervalUnit.MINUTE && repeatInterval > secondsInHour / 60L) { throw new SchedulerException("repeatInterval can not exceed 24 hours (" + secondsInHour / 60L + " minutes). Given " + repeatInterval); } if (repeatIntervalUnit == IntervalUnit.HOUR && repeatInterval > 24 ) { throw new SchedulerException("repeatInterval can not exceed 24 hours. Given " + repeatInterval + " hours."); } // Ensure timeOfDay is in order. if (getEndTimeOfDay() != null && !getStartTimeOfDay().before(getEndTimeOfDay())) { throw new SchedulerException("StartTimeOfDay " + startTimeOfDay + " should not come after endTimeOfDay " + endTimeOfDay); } }
Example #8
Source File: DailyTimeIntervalTriggerImpl.java From lams with GNU General Public License v2.0 | 5 votes |
/** * <p>Set the interval unit - the time unit on with the interval applies.</p> * * @param intervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are * {@link IntervalUnit#SECOND}, {@link IntervalUnit#MINUTE}, and {@link IntervalUnit#HOUR}. */ public void setRepeatIntervalUnit(IntervalUnit intervalUnit) { if (repeatIntervalUnit == null || !((repeatIntervalUnit.equals(IntervalUnit.SECOND) || repeatIntervalUnit.equals(IntervalUnit.MINUTE) || repeatIntervalUnit.equals(IntervalUnit.HOUR)))) throw new IllegalArgumentException("Invalid repeat IntervalUnit (must be SECOND, MINUTE or HOUR)."); this.repeatIntervalUnit = intervalUnit; }
Example #9
Source File: Context.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public <T extends AbstractJob> void scheduleLocal(Class<T> cls, Integer delay, Integer interval) throws Exception { JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put("context", this); JobDetail jobDetail = JobBuilder.newJob(cls).withIdentity(cls.getName(), clazz.getName()) .usingJobData(jobDataMap).withDescription(Config.node()).build(); Trigger trigger = TriggerBuilder.newTrigger().withIdentity(cls.getName(), clazz.getName()) .withDescription("scheduleLocal").startAt(DateBuilder.futureDate(delay, IntervalUnit.SECOND)) .withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(interval).repeatForever()) .build(); scheduler.scheduleJob(jobDetail, trigger); this.scheduleLocalRequestList.add(new ScheduleLocalRequest(jobDetail, null, delay, interval)); }
Example #10
Source File: Context.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public <T extends AbstractJob> void fireScheduleOnLocal(Class<T> cls, Integer delay) throws Exception { /* 需要单独生成一个独立任务,保证group和预约的任务不重复 */ JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put("context", this); JobDetail jobDetail = JobBuilder.newJob(cls).withIdentity(cls.getName(), clazz.getName()) .usingJobData(jobDataMap).withDescription(Config.node()).build(); /* 经过测试0代表不重复,仅运行一次 */ Trigger trigger = TriggerBuilder.newTrigger().withIdentity(cls.getName(), clazz.getName()) .withDescription("schedule").startAt(DateBuilder.futureDate(delay, IntervalUnit.SECOND)) .withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(1).withRepeatCount(0)) .build(); scheduler.scheduleJob(jobDetail, trigger); }
Example #11
Source File: Context.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public <T extends AbstractJob> void scheduleLocal(Class<T> cls, Integer delay) throws Exception { /* 需要单独生成一个独立任务,保证group和预约的任务不重复 */ JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put("context", this); JobDetail jobDetail = JobBuilder.newJob(cls).withIdentity(cls.getName(), clazz.getName()) .usingJobData(jobDataMap).withDescription(Config.node()).build(); /* 经过测试0代表不重复,仅运行一次 */ Trigger trigger = TriggerBuilder.newTrigger().withIdentity(cls.getName(), clazz.getName()) .withDescription("scheduleLocal").startAt(DateBuilder.futureDate(delay, IntervalUnit.SECOND)) .withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(1).withRepeatCount(0)) .build(); scheduler.scheduleJob(jobDetail, trigger); }
Example #12
Source File: Context.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public <T extends Job> void scheduleLocal(Class<T> cls, Integer delay, Integer interval) throws Exception { JobDetail jobDetail = JobBuilder.newJob(cls).withIdentity(cls.getName(), clazz.getName()) .withDescription(Config.node()).build(); Trigger trigger = TriggerBuilder.newTrigger().withIdentity(cls.getName(), clazz.getName()) .withDescription("scheduleLocal").startAt(DateBuilder.futureDate(delay, IntervalUnit.SECOND)) .withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(interval).repeatForever()) .build(); scheduler.scheduleJob(jobDetail, trigger); }
Example #13
Source File: CalendarIntervalTriggerImpl.java From lams with GNU General Public License v2.0 | 4 votes |
/** * <p>Set the interval unit - the time unit on with the interval applies.</p> */ public void setRepeatIntervalUnit(IntervalUnit intervalUnit) { this.repeatIntervalUnit = intervalUnit; }
Example #14
Source File: DailyTimeIntervalScheduleBuilder.java From lams with GNU General Public License v2.0 | 4 votes |
/** * Calculate and set the endTimeOfDay using count, interval and starTimeOfDay. This means * that these must be set before this method is call. * * @return the updated DailyTimeIntervalScheduleBuilder */ public DailyTimeIntervalScheduleBuilder endingDailyAfterCount(int count) { if(count <=0) throw new IllegalArgumentException("Ending daily after count must be a positive number!"); if(startTimeOfDay == null) throw new IllegalArgumentException("You must set the startDailyAt() before calling this endingDailyAfterCount()!"); Date today = new Date(); Date startTimeOfDayDate = startTimeOfDay.getTimeOfDayForDate(today); Date maxEndTimeOfDayDate = TimeOfDay.hourMinuteAndSecondOfDay(23, 59, 59).getTimeOfDayForDate(today); long remainingMillisInDay = maxEndTimeOfDayDate.getTime() - startTimeOfDayDate.getTime(); long intervalInMillis; if (intervalUnit == IntervalUnit.SECOND) intervalInMillis = interval * 1000L; else if (intervalUnit == IntervalUnit.MINUTE) intervalInMillis = interval * 1000L * 60; else if (intervalUnit == IntervalUnit.HOUR) intervalInMillis = interval * 1000L * 60 * 24; else throw new IllegalArgumentException("The IntervalUnit: " + intervalUnit + " is invalid for this trigger."); if (remainingMillisInDay - intervalInMillis <= 0) throw new IllegalArgumentException("The startTimeOfDay is too late with given Interval and IntervalUnit values."); long maxNumOfCount = (remainingMillisInDay / intervalInMillis); if (count > maxNumOfCount) throw new IllegalArgumentException("The given count " + count + " is too large! The max you can set is " + maxNumOfCount); long incrementInMillis = (count - 1) * intervalInMillis; Date endTimeOfDayDate = new Date(startTimeOfDayDate.getTime() + incrementInMillis); if (endTimeOfDayDate.getTime() > maxEndTimeOfDayDate.getTime()) throw new IllegalArgumentException("The given count " + count + " is too large! The max you can set is " + maxNumOfCount); Calendar cal = Calendar.getInstance(); cal.setTime(endTimeOfDayDate); int hour = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); endTimeOfDay = TimeOfDay.hourMinuteAndSecondOfDay(hour, minute, second); return this; }
Example #15
Source File: CalendarIntervalTriggerImpl.java From lams with GNU General Public License v2.0 | 4 votes |
/** * <p> * Returns the final time at which the <code>DateIntervalTrigger</code> will * fire, if there is no end time set, null will be returned. * </p> * * <p> * Note that the return time may be in the past. * </p> */ @Override public Date getFinalFireTime() { if (complete || getEndTime() == null) { return null; } // back up a second from end time Date fTime = new Date(getEndTime().getTime() - 1000L); // find the next fire time after that fTime = getFireTimeAfter(fTime, true); // the the trigger fires at the end time, that's it! if(fTime.equals(getEndTime())) return fTime; // otherwise we have to back up one interval from the fire time after the end time Calendar lTime = Calendar.getInstance(); if(timeZone != null) lTime.setTimeZone(timeZone); lTime.setTime(fTime); lTime.setLenient(true); if(getRepeatIntervalUnit().equals(IntervalUnit.SECOND)) { lTime.add(java.util.Calendar.SECOND, -1 * getRepeatInterval()); } else if(getRepeatIntervalUnit().equals(IntervalUnit.MINUTE)) { lTime.add(java.util.Calendar.MINUTE, -1 * getRepeatInterval()); } else if(getRepeatIntervalUnit().equals(IntervalUnit.HOUR)) { lTime.add(java.util.Calendar.HOUR_OF_DAY, -1 * getRepeatInterval()); } else if(getRepeatIntervalUnit().equals(IntervalUnit.DAY)) { lTime.add(java.util.Calendar.DAY_OF_YEAR, -1 * getRepeatInterval()); } else if(getRepeatIntervalUnit().equals(IntervalUnit.WEEK)) { lTime.add(java.util.Calendar.WEEK_OF_YEAR, -1 * getRepeatInterval()); } else if(getRepeatIntervalUnit().equals(IntervalUnit.MONTH)) { lTime.add(java.util.Calendar.MONTH, -1 * getRepeatInterval()); } else if(getRepeatIntervalUnit().equals(IntervalUnit.YEAR)) { lTime.add(java.util.Calendar.YEAR, -1 * getRepeatInterval()); } return lTime.getTime(); }
Example #16
Source File: CalendarIntervalTriggerImpl.java From lams with GNU General Public License v2.0 | 4 votes |
public IntervalUnit getRepeatIntervalUnit() { return repeatIntervalUnit; }
Example #17
Source File: DailyTimeIntervalTriggerImpl.java From lams with GNU General Public License v2.0 | 4 votes |
public IntervalUnit getRepeatIntervalUnit() { return repeatIntervalUnit; }
Example #18
Source File: DailyTimeIntervalTriggerImpl.java From lams with GNU General Public License v2.0 | 3 votes |
/** * <p> * Create a <code>DailyTimeIntervalTrigger</code> that will occur at the given time, * fire the identified <code>Job</code> and repeat at the the given * interval until the given end time. * </p> * * @param startTime * A <code>Date</code> set to the time for the <code>Trigger</code> * to fire. * @param endTime * A <code>Date</code> set to the time for the <code>Trigger</code> * to quit repeat firing. * @param startTimeOfDay * The <code>TimeOfDay</code> that the repeating should begin occurring. * @param endTimeOfDay * The <code>TimeOfDay</code> that the repeating should stop occurring. * @param intervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are * {@link IntervalUnit#SECOND}, {@link IntervalUnit#MINUTE}, and {@link IntervalUnit#HOUR}. * @param repeatInterval * The number of milliseconds to pause between the repeat firing. * @throws IllegalArgumentException if an invalid IntervalUnit is given, or the repeat interval is zero or less. */ public DailyTimeIntervalTriggerImpl(String name, String group, String jobName, String jobGroup, Date startTime, Date endTime, TimeOfDay startTimeOfDay, TimeOfDay endTimeOfDay, IntervalUnit intervalUnit, int repeatInterval) { super(name, group, jobName, jobGroup); setStartTime(startTime); setEndTime(endTime); setRepeatIntervalUnit(intervalUnit); setRepeatInterval(repeatInterval); setStartTimeOfDay(startTimeOfDay); setEndTimeOfDay(endTimeOfDay); }
Example #19
Source File: CalendarIntervalScheduleBuilder.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Specify an interval in the IntervalUnit.YEAR that the produced * Trigger will repeat at. * * @param intervalInYears the number of years at which the trigger should repeat. * @return the updated CalendarIntervalScheduleBuilder * @see CalendarIntervalTrigger#getRepeatInterval() * @see CalendarIntervalTrigger#getRepeatIntervalUnit() */ public CalendarIntervalScheduleBuilder withIntervalInYears(int intervalInYears) { validateInterval(intervalInYears); this.interval = intervalInYears; this.intervalUnit = IntervalUnit.YEAR; return this; }
Example #20
Source File: CalendarIntervalTriggerImpl.java From lams with GNU General Public License v2.0 | 3 votes |
/** * <p> * Create a <code>DateIntervalTrigger</code> that will occur at the given time, * and repeat at the the given interval until the given end time. * </p> * * @param startTime * A <code>Date</code> set to the time for the <code>Trigger</code> * to fire. * @param endTime * A <code>Date</code> set to the time for the <code>Trigger</code> * to quit repeat firing. * @param intervalUnit * The repeat interval unit (minutes, days, months, etc). * @param repeatInterval * The number of milliseconds to pause between the repeat firing. */ public CalendarIntervalTriggerImpl(String name, String group, Date startTime, Date endTime, IntervalUnit intervalUnit, int repeatInterval) { super(name, group); setStartTime(startTime); setEndTime(endTime); setRepeatIntervalUnit(intervalUnit); setRepeatInterval(repeatInterval); }
Example #21
Source File: CalendarIntervalTriggerImpl.java From lams with GNU General Public License v2.0 | 3 votes |
/** * <p> * Create a <code>DateIntervalTrigger</code> that will occur at the given time, * fire the identified <code>Job</code> and repeat at the the given * interval until the given end time. * </p> * * @param startTime * A <code>Date</code> set to the time for the <code>Trigger</code> * to fire. * @param endTime * A <code>Date</code> set to the time for the <code>Trigger</code> * to quit repeat firing. * @param intervalUnit * The repeat interval unit (minutes, days, months, etc). * @param repeatInterval * The number of milliseconds to pause between the repeat firing. */ public CalendarIntervalTriggerImpl(String name, String group, String jobName, String jobGroup, Date startTime, Date endTime, IntervalUnit intervalUnit, int repeatInterval) { super(name, group, jobName, jobGroup); setStartTime(startTime); setEndTime(endTime); setRepeatIntervalUnit(intervalUnit); setRepeatInterval(repeatInterval); }
Example #22
Source File: DailyTimeIntervalTriggerImpl.java From lams with GNU General Public License v2.0 | 3 votes |
/** * <p> * Create a <code>DailyTimeIntervalTrigger</code> that will occur at the given time, * and repeat at the the given interval until the given end time. * </p> * * @param startTime * A <code>Date</code> set to the time for the <code>Trigger</code> * to fire. * @param endTime * A <code>Date</code> set to the time for the <code>Trigger</code> * to quit repeat firing. * @param startTimeOfDay * The <code>TimeOfDay</code> that the repeating should begin occurring. * @param endTimeOfDay * The <code>TimeOfDay</code> that the repeating should stop occurring. * @param intervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are * {@link IntervalUnit#SECOND}, {@link IntervalUnit#MINUTE}, and {@link IntervalUnit#HOUR}. * @param repeatInterval * The number of milliseconds to pause between the repeat firing. * @throws IllegalArgumentException if an invalid IntervalUnit is given, or the repeat interval is zero or less. */ public DailyTimeIntervalTriggerImpl(String name, String group, Date startTime, Date endTime, TimeOfDay startTimeOfDay, TimeOfDay endTimeOfDay, IntervalUnit intervalUnit, int repeatInterval) { super(name, group); setStartTime(startTime); setEndTime(endTime); setRepeatIntervalUnit(intervalUnit); setRepeatInterval(repeatInterval); setStartTimeOfDay(startTimeOfDay); setEndTimeOfDay(endTimeOfDay); }
Example #23
Source File: CalendarIntervalScheduleBuilder.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Specify an interval in the IntervalUnit.MONTH that the produced * Trigger will repeat at. * * @param intervalInMonths the number of months at which the trigger should repeat. * @return the updated CalendarIntervalScheduleBuilder * @see CalendarIntervalTrigger#getRepeatInterval() * @see CalendarIntervalTrigger#getRepeatIntervalUnit() */ public CalendarIntervalScheduleBuilder withIntervalInMonths(int intervalInMonths) { validateInterval(intervalInMonths); this.interval = intervalInMonths; this.intervalUnit = IntervalUnit.MONTH; return this; }
Example #24
Source File: CalendarIntervalScheduleBuilder.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Specify an interval in the IntervalUnit.WEEK that the produced * Trigger will repeat at. * * @param intervalInWeeks the number of weeks at which the trigger should repeat. * @return the updated CalendarIntervalScheduleBuilder * @see CalendarIntervalTrigger#getRepeatInterval() * @see CalendarIntervalTrigger#getRepeatIntervalUnit() */ public CalendarIntervalScheduleBuilder withIntervalInWeeks(int intervalInWeeks) { validateInterval(intervalInWeeks); this.interval = intervalInWeeks; this.intervalUnit = IntervalUnit.WEEK; return this; }
Example #25
Source File: DailyTimeIntervalScheduleBuilder.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Specify the time unit and interval for the Trigger to be produced. * * @param timeInterval the interval at which the trigger should repeat. * @param unit the time unit (IntervalUnit) of the interval. The only intervals that are valid for this type of * trigger are {@link IntervalUnit#SECOND}, {@link IntervalUnit#MINUTE}, and {@link IntervalUnit#HOUR}. * @return the updated DailyTimeIntervalScheduleBuilder * @see DailyTimeIntervalTrigger#getRepeatInterval() * @see DailyTimeIntervalTrigger#getRepeatIntervalUnit() */ public DailyTimeIntervalScheduleBuilder withInterval(int timeInterval, IntervalUnit unit) { if (unit == null || !(unit.equals(IntervalUnit.SECOND) || unit.equals(IntervalUnit.MINUTE) ||unit.equals(IntervalUnit.HOUR))) throw new IllegalArgumentException("Invalid repeat IntervalUnit (must be SECOND, MINUTE or HOUR)."); validateInterval(timeInterval); this.interval = timeInterval; this.intervalUnit = unit; return this; }
Example #26
Source File: CalendarIntervalScheduleBuilder.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Specify an interval in the IntervalUnit.DAY that the produced * Trigger will repeat at. * * @param intervalInDays the number of days at which the trigger should repeat. * @return the updated CalendarIntervalScheduleBuilder * @see CalendarIntervalTrigger#getRepeatInterval() * @see CalendarIntervalTrigger#getRepeatIntervalUnit() */ public CalendarIntervalScheduleBuilder withIntervalInDays(int intervalInDays) { validateInterval(intervalInDays); this.interval = intervalInDays; this.intervalUnit = IntervalUnit.DAY; return this; }
Example #27
Source File: CalendarIntervalScheduleBuilder.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Specify an interval in the IntervalUnit.HOUR that the produced * Trigger will repeat at. * * @param intervalInHours the number of hours at which the trigger should repeat. * @return the updated CalendarIntervalScheduleBuilder * @see CalendarIntervalTrigger#getRepeatInterval() * @see CalendarIntervalTrigger#getRepeatIntervalUnit() */ public CalendarIntervalScheduleBuilder withIntervalInHours(int intervalInHours) { validateInterval(intervalInHours); this.interval = intervalInHours; this.intervalUnit = IntervalUnit.HOUR; return this; }
Example #28
Source File: CalendarIntervalScheduleBuilder.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Specify an interval in the IntervalUnit.MINUTE that the produced * Trigger will repeat at. * * @param intervalInMinutes the number of minutes at which the trigger should repeat. * @return the updated CalendarIntervalScheduleBuilder * @see CalendarIntervalTrigger#getRepeatInterval() * @see CalendarIntervalTrigger#getRepeatIntervalUnit() */ public CalendarIntervalScheduleBuilder withIntervalInMinutes(int intervalInMinutes) { validateInterval(intervalInMinutes); this.interval = intervalInMinutes; this.intervalUnit = IntervalUnit.MINUTE; return this; }
Example #29
Source File: CalendarIntervalScheduleBuilder.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Specify an interval in the IntervalUnit.SECOND that the produced * Trigger will repeat at. * * @param intervalInSeconds the number of seconds at which the trigger should repeat. * @return the updated CalendarIntervalScheduleBuilder * @see CalendarIntervalTrigger#getRepeatInterval() * @see CalendarIntervalTrigger#getRepeatIntervalUnit() */ public CalendarIntervalScheduleBuilder withIntervalInSeconds(int intervalInSeconds) { validateInterval(intervalInSeconds); this.interval = intervalInSeconds; this.intervalUnit = IntervalUnit.SECOND; return this; }
Example #30
Source File: CalendarIntervalScheduleBuilder.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Specify the time unit and interval for the Trigger to be produced. * * @param timeInterval the interval at which the trigger should repeat. * @param unit the time unit (IntervalUnit) of the interval. * @return the updated CalendarIntervalScheduleBuilder * @see CalendarIntervalTrigger#getRepeatInterval() * @see CalendarIntervalTrigger#getRepeatIntervalUnit() */ public CalendarIntervalScheduleBuilder withInterval(int timeInterval, IntervalUnit unit) { if(unit == null) throw new IllegalArgumentException("TimeUnit must be specified."); validateInterval(timeInterval); this.interval = timeInterval; this.intervalUnit = unit; return this; }