Java Code Examples for org.quartz.impl.triggers.SimpleTriggerImpl#setRepeatCount()
The following examples show how to use
org.quartz.impl.triggers.SimpleTriggerImpl#setRepeatCount() .
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: ScheduledInfo.java From GOAi with GNU Affero General Public License v3.0 | 5 votes |
/** * 设置触发器 */ private void initSimpleTrigger() { if (this.fixedRate <= 0 || this.delay < 0) { return; } SimpleTriggerImpl simpleTrigger = new SimpleTriggerImpl(); simpleTrigger.setRepeatInterval(this.fixedRate); this.tip = "fixedRate: " + this.fixedRate + " ms delay: " + this.delay + " ms"; // 无限次 simpleTrigger.setRepeatCount(-1); simpleTrigger.setStartTime(new Date(System.currentTimeMillis() + this.delay)); this.trigger = simpleTrigger; this.cron = ""; }
Example 2
Source File: SimpleTriggerFactoryBean.java From spring-analysis-note with MIT License | 5 votes |
@Override public void afterPropertiesSet() { if (this.name == null) { this.name = this.beanName; } if (this.group == null) { this.group = Scheduler.DEFAULT_GROUP; } if (this.jobDetail != null) { this.jobDataMap.put("jobDetail", this.jobDetail); } if (this.startDelay > 0 || this.startTime == null) { this.startTime = new Date(System.currentTimeMillis() + this.startDelay); } SimpleTriggerImpl sti = new SimpleTriggerImpl(); sti.setName(this.name != null ? this.name : toString()); sti.setGroup(this.group); if (this.jobDetail != null) { sti.setJobKey(this.jobDetail.getKey()); } sti.setJobDataMap(this.jobDataMap); sti.setStartTime(this.startTime); sti.setRepeatInterval(this.repeatInterval); sti.setRepeatCount(this.repeatCount); sti.setPriority(this.priority); sti.setMisfireInstruction(this.misfireInstruction); sti.setDescription(this.description); this.simpleTrigger = sti; }
Example 3
Source File: SimpleTriggerFactoryBean.java From java-technology-stack with MIT License | 5 votes |
@Override public void afterPropertiesSet() { if (this.name == null) { this.name = this.beanName; } if (this.group == null) { this.group = Scheduler.DEFAULT_GROUP; } if (this.jobDetail != null) { this.jobDataMap.put("jobDetail", this.jobDetail); } if (this.startDelay > 0 || this.startTime == null) { this.startTime = new Date(System.currentTimeMillis() + this.startDelay); } SimpleTriggerImpl sti = new SimpleTriggerImpl(); sti.setName(this.name != null ? this.name : toString()); sti.setGroup(this.group); if (this.jobDetail != null) { sti.setJobKey(this.jobDetail.getKey()); } sti.setJobDataMap(this.jobDataMap); sti.setStartTime(this.startTime); sti.setRepeatInterval(this.repeatInterval); sti.setRepeatCount(this.repeatCount); sti.setPriority(this.priority); sti.setMisfireInstruction(this.misfireInstruction); sti.setDescription(this.description); this.simpleTrigger = sti; }
Example 4
Source File: EntityMocksHelper.java From griffin with Apache License 2.0 | 5 votes |
public static SimpleTrigger createSimpleTrigger( int repeatCount, int triggerCount) { SimpleTriggerImpl trigger = new SimpleTriggerImpl(); trigger.setRepeatCount(repeatCount); trigger.setTimesTriggered(triggerCount); trigger.setPreviousFireTime(new Date()); return trigger; }
Example 5
Source File: SimpleTriggerFactoryBean.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void afterPropertiesSet() { if (this.name == null) { this.name = this.beanName; } if (this.group == null) { this.group = Scheduler.DEFAULT_GROUP; } if (this.jobDetail != null) { this.jobDataMap.put("jobDetail", this.jobDetail); } if (this.startDelay > 0 || this.startTime == null) { this.startTime = new Date(System.currentTimeMillis() + this.startDelay); } SimpleTriggerImpl sti = new SimpleTriggerImpl(); sti.setName(this.name); sti.setGroup(this.group); if (this.jobDetail != null) { sti.setJobKey(this.jobDetail.getKey()); } sti.setJobDataMap(this.jobDataMap); sti.setStartTime(this.startTime); sti.setRepeatInterval(this.repeatInterval); sti.setRepeatCount(this.repeatCount); sti.setPriority(this.priority); sti.setMisfireInstruction(this.misfireInstruction); sti.setDescription(this.description); this.simpleTrigger = sti; }
Example 6
Source File: SimpleScheduleBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Build the actual Trigger -- NOT intended to be invoked by end users, * but will rather be invoked by a TriggerBuilder which this * ScheduleBuilder is given to. * * @see TriggerBuilder#withSchedule(ScheduleBuilder) */ @Override public MutableTrigger build() { SimpleTriggerImpl st = new SimpleTriggerImpl(); st.setRepeatInterval(interval); st.setRepeatCount(repeatCount); st.setMisfireInstruction(misfireInstruction); return st; }
Example 7
Source File: SimpleTriggerSupport.java From lams with GNU General Public License v2.0 | 5 votes |
public static OperableTrigger newTrigger(CompositeData cData) throws ParseException { SimpleTriggerImpl result = new SimpleTriggerImpl(); result.setRepeatCount(((Integer) cData.get("repeatCount")).intValue()); result.setRepeatInterval(((Long) cData.get("repeatInterval")).longValue()); result.setTimesTriggered(((Integer) cData.get("timesTriggered")).intValue()); TriggerSupport.initializeTrigger(result, cData); return result; }
Example 8
Source File: SimpleTriggerSupport.java From lams with GNU General Public License v2.0 | 5 votes |
public static OperableTrigger newTrigger(Map<String, Object> attrMap) throws ParseException { SimpleTriggerImpl result = new SimpleTriggerImpl(); if(attrMap.containsKey("repeatCount")) { result.setRepeatCount(((Integer) attrMap.get("repeatCount")).intValue()); } if(attrMap.containsKey("repeatInterval")) { result.setRepeatInterval(((Long) attrMap.get("repeatInterval")).longValue()); } if(attrMap.containsKey("timesTriggered")) { result.setTimesTriggered(((Integer) attrMap.get("timesTriggered")).intValue()); } TriggerSupport.initializeTrigger(result, attrMap); return result; }
Example 9
Source File: SimpleTriggerFactoryBean.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void afterPropertiesSet() { if (this.name == null) { this.name = this.beanName; } if (this.group == null) { this.group = Scheduler.DEFAULT_GROUP; } if (this.jobDetail != null) { this.jobDataMap.put("jobDetail", this.jobDetail); } if (this.startDelay > 0 || this.startTime == null) { this.startTime = new Date(System.currentTimeMillis() + this.startDelay); } SimpleTriggerImpl sti = new SimpleTriggerImpl(); sti.setName(this.name); sti.setGroup(this.group); sti.setJobKey(this.jobDetail.getKey()); sti.setJobDataMap(this.jobDataMap); sti.setStartTime(this.startTime); sti.setRepeatInterval(this.repeatInterval); sti.setRepeatCount(this.repeatCount); sti.setPriority(this.priority); sti.setMisfireInstruction(this.misfireInstruction); sti.setDescription(this.description); this.simpleTrigger = sti; }
Example 10
Source File: RedisJobStore.java From redis-quartz with MIT License | 5 votes |
private OperableTrigger toOperableTrigger(TriggerKey triggerKey, Map<String, String> trigger) { if (TRIGGER_TYPE_SIMPLE.equals(trigger.get(TRIGGER_TYPE))) { SimpleTriggerImpl simpleTrigger = new SimpleTriggerImpl(); setOperableTriggerFields(triggerKey, trigger, simpleTrigger); if (trigger.get(REPEAT_COUNT) != null && !trigger.get(REPEAT_COUNT).isEmpty()) simpleTrigger.setRepeatCount(Integer.parseInt(trigger.get(REPEAT_COUNT))); if (trigger.get(REPEAT_INTERVAL) != null && !trigger.get(REPEAT_INTERVAL).isEmpty()) simpleTrigger.setRepeatInterval(Long.parseLong(trigger.get(REPEAT_INTERVAL))); if (trigger.get(TIMES_TRIGGERED) != null && !trigger.get(TIMES_TRIGGERED).isEmpty()) simpleTrigger.setTimesTriggered(Integer.parseInt(trigger.get(TIMES_TRIGGERED))); return simpleTrigger; } else if (TRIGGER_TYPE_CRON.equals(trigger.get(TRIGGER_TYPE))) { CronTriggerImpl cronTrigger = new CronTriggerImpl(); setOperableTriggerFields(triggerKey, trigger, cronTrigger); if (trigger.get(TIME_ZONE_ID) != null && !trigger.get(TIME_ZONE_ID).isEmpty()) cronTrigger.getTimeZone().setID(trigger.get(TIME_ZONE_ID).isEmpty() ? null : trigger.get(TIME_ZONE_ID)); try { if (trigger.get(CRON_EXPRESSION) != null && !trigger.get(CRON_EXPRESSION).isEmpty()) cronTrigger.setCronExpression(trigger.get(CRON_EXPRESSION).isEmpty() ? null : trigger.get(CRON_EXPRESSION)); } catch (ParseException ex) { log.warn("could not parse cron_expression: " + trigger.get(CRON_EXPRESSION) + " for trigger: " + createTriggerHashKey(triggerKey.getGroup(), triggerKey.getName())); } return cronTrigger; } else { // other trigger types are not supported throw new UnsupportedOperationException(); } }
Example 11
Source File: SchedulerServiceImpl.java From uflo with Apache License 2.0 | 4 votes |
public void addReminderJob(TaskReminder reminder,ProcessInstance processInstance,Task task) { JobKey jobKey=new JobKey(JOB_NAME_PREFIX+reminder.getId(),JOB_GROUP_PREFIX); try { if(scheduler.checkExists(jobKey)){ return; } AbstractTrigger<? extends Trigger> trigger=null; if(reminder.getType().equals(ReminderType.Once)){ SimpleTriggerImpl simpleTrigger=new SimpleTriggerImpl(); simpleTrigger.setRepeatCount(0); trigger=simpleTrigger; long executeTime=reminder.getStartDate().getTime()+10000; long now=(new Date()).getTime(); if(executeTime<=now){ return; } }else{ CronTriggerImpl cronTrigger=new CronTriggerImpl(); cronTrigger.setCronExpression(reminder.getCron()); trigger=cronTrigger; } trigger.setName("trigger_"+reminder.getId()); trigger.setStartTime(reminder.getStartDate()); ReminderJobDetail jobDetail=new ReminderJobDetail(); jobDetail.setJobClass(ReminderJob.class); ReminderHandler handler=(ReminderHandler)applicationContext.getBean(reminder.getReminderHandlerBean()); jobDetail.setReminderHandlerBean(handler); if(task==null){ task=taskService.getTask(reminder.getTaskId()); } jobDetail.setTask(task); jobDetail.setProcessInstance(processService.getProcessInstanceById(task.getProcessInstanceId())); jobDetail.setKey(jobKey); Calendar calendar=getCalendar(reminder,processInstance,task); if(calendar!=null){ String calendarName=REMINDER_CALENDAR_PREFIX+reminder.getId(); scheduler.addCalendar(calendarName, calendar,false, false); trigger.setCalendarName(calendarName); } scheduler.scheduleJob(jobDetail, trigger); } catch (Exception e) { throw new RuntimeException(e); } }