org.springframework.scheduling.quartz.SimpleTriggerFactoryBean Java Examples
The following examples show how to use
org.springframework.scheduling.quartz.SimpleTriggerFactoryBean.
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: QuartzConfig.java From MyCommunity with Apache License 2.0 | 5 votes |
public SimpleTriggerFactoryBean postScoreRefreshTrigger(JobDetail postScoreRefreshJobDetail) { SimpleTriggerFactoryBean factoryBean = new SimpleTriggerFactoryBean(); factoryBean.setJobDetail(postScoreRefreshJobDetail); factoryBean.setName("postScoreRefreshTrigger"); factoryBean.setGroup("communityTriggerGroup"); // factoryBean.setRepeatInterval(1000 * 60 * 5); // 5分钟 factoryBean.setRepeatInterval(1000 * 60 * 120); // 2小时 factoryBean.setJobDataMap(new JobDataMap()); return factoryBean; }
Example #2
Source File: QuartzConfigration.java From Tbed with GNU Affero General Public License v3.0 | 5 votes |
@Bean(name = "firstTrigger") public SimpleTriggerFactoryBean firstTrigger(JobDetail firstJobDetail) { SimpleTriggerFactoryBean trigger = new SimpleTriggerFactoryBean(); trigger.setJobDetail(firstJobDetail); // 设置任务启动延迟 trigger.setStartDelay(0); // 每5秒执行一次 trigger.setRepeatInterval(3600000);//一小时 return trigger; }
Example #3
Source File: QuartzConfig.java From MyCommunity with Apache License 2.0 | 5 votes |
/** *注意 参数 alphaJobDetail 的名字要上下一致,这样当有多个 * JobDetailFactoryBean 实例时,Spring会优先根据 * 名字匹配进行注入 * */ // 配置Trigger(SimpleTriggerFactoryBean, CronTriggerFactoryBean) // @Bean public SimpleTriggerFactoryBean alphaTrigger(JobDetail alphaJobDetail) { SimpleTriggerFactoryBean factoryBean = new SimpleTriggerFactoryBean(); factoryBean.setJobDetail(alphaJobDetail); factoryBean.setName("alphaTrigger"); factoryBean.setGroup("alphaTriggerGroup"); factoryBean.setRepeatInterval(3000); // 每 3 秒执行一次 factoryBean.setJobDataMap(new JobDataMap()); // Trigger 底层以 JobDataMap() 数据类型保存Job的一些状态 return factoryBean; }
Example #4
Source File: JobUtil.java From spring-boot-quartz-demo with MIT License | 5 votes |
/** * Create a Single trigger. * * @param triggerName Trigger name. * @param startTime Trigger start time. * @param misFireInstruction Misfire instruction (what to do in case of misfire happens). * * @return Trigger */ protected static Trigger createSingleTrigger(String triggerName, Date startTime, int misFireInstruction){ SimpleTriggerFactoryBean factoryBean = new SimpleTriggerFactoryBean(); factoryBean.setName(triggerName); factoryBean.setStartTime(startTime); factoryBean.setMisfireInstruction(misFireInstruction); factoryBean.setRepeatCount(0); factoryBean.afterPropertiesSet(); return factoryBean.getObject(); }
Example #5
Source File: SchedulerConfig.java From ehousechina with Apache License 2.0 | 5 votes |
@Bean(name = "sampleJobTrigger") public SimpleTriggerFactoryBean sampleJobTrigger(@Qualifier("sampleJobDetail") JobDetail jobDetail) { SimpleTriggerFactoryBean factoryBean = new SimpleTriggerFactoryBean(); factoryBean.setJobDetail(jobDetail); factoryBean.setStartDelay(0L); factoryBean.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY); factoryBean.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT); return factoryBean; }
Example #6
Source File: SchedulerConfig.java From quartz-manager with Apache License 2.0 | 5 votes |
private static SimpleTriggerFactoryBean createTrigger(JobDetail jobDetail, long pollFrequencyMs, int repeatCount) { SimpleTriggerFactoryBean factoryBean = new SimpleTriggerFactoryBean(); factoryBean.setJobDetail(jobDetail); factoryBean.setStartDelay(3000L); factoryBean.setRepeatInterval(pollFrequencyMs); factoryBean.setRepeatCount(repeatCount); factoryBean .setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT);// in case of misfire, ignore all missed triggers and continue return factoryBean; }
Example #7
Source File: RepositoryManualScreenshotRunJob.java From mojito with Apache License 2.0 | 5 votes |
@Bean public SimpleTriggerFactoryBean triggerRepositoryManualScreenshotRunJob(@Qualifier("repositoryManualScreenshotRun") JobDetail job) { SimpleTriggerFactoryBean simpleTriggerFactoryBean = new SimpleTriggerFactoryBean(); simpleTriggerFactoryBean.setJobDetail(job); simpleTriggerFactoryBean.setRepeatCount(0); return simpleTriggerFactoryBean; }
Example #8
Source File: PluralFormUpdaterJob.java From mojito with Apache License 2.0 | 5 votes |
@Bean SimpleTriggerFactoryBean triggerPluralFormUpdater(@Qualifier("jobDetailPluralFromUpdater") JobDetail job) { SimpleTriggerFactoryBean trigger = new SimpleTriggerFactoryBean(); trigger.setJobDetail(job); trigger.setRepeatInterval(10000); trigger.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY); return trigger; }
Example #9
Source File: PollableTaskCleanupJob.java From mojito with Apache License 2.0 | 5 votes |
@Bean public SimpleTriggerFactoryBean triggerPollableTaskCleanup(@Qualifier("jobDetailPollableTaskCleanup") JobDetail job) { SimpleTriggerFactoryBean trigger = new SimpleTriggerFactoryBean(); trigger.setJobDetail(job); trigger.setRepeatInterval(REPEAT_INTERVAL); trigger.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY); return trigger; }
Example #10
Source File: AssetExtractionCleanupJob.java From mojito with Apache License 2.0 | 5 votes |
@Bean public SimpleTriggerFactoryBean triggerAssetExtractionCleanup(@Qualifier("jobDetailAssetExtractionCleanup") JobDetail job) { SimpleTriggerFactoryBean trigger = new SimpleTriggerFactoryBean(); trigger.setJobDetail(job); trigger.setRepeatInterval(Duration.ofMinutes(5).toMillis()); trigger.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY); return trigger; }
Example #11
Source File: TestContextConfiguration4.java From spring-boot-starter-quartz with Apache License 2.0 | 5 votes |
@Bean(name="simpleJobTrigger2") public SimpleTriggerFactoryBean createSimpleTrigger2(@Qualifier("simpleJobDetail") JobDetail jobDetail) { Map<String, Object> map = new HashMap<>(1); map.put("myKey", "myValue"); return QuartzUtils.createSimpleTrigger(jobDetail, "STName2", "STGroup2", "STDesc2", 10000L, 30000L, SimpleTrigger.REPEAT_INDEFINITELY, SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT, map, 1000); }
Example #12
Source File: BlobStorageConfiguration.java From mojito with Apache License 2.0 | 5 votes |
@Profile("!disablescheduling") @Bean public SimpleTriggerFactoryBean triggerExpiringBlobCleanup(@Qualifier("jobDetailDatabaseBlobStorageCleanupJob") JobDetail job) { logger.info("Configure jobDetailDatabaseBlobStorageCleanupJob"); SimpleTriggerFactoryBean trigger = new SimpleTriggerFactoryBean(); trigger.setJobDetail(job); trigger.setRepeatInterval(Duration.ofMinutes(5).toMillis()); trigger.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY); return trigger; }
Example #13
Source File: TestContextConfiguration11.java From spring-boot-starter-quartz with Apache License 2.0 | 5 votes |
@Bean(name="simpleJobTrigger2") public SimpleTriggerFactoryBean createSimpleTrigger2(@Qualifier("simpleJobDetail") JobDetail jobDetail) { Map<String, Object> map = new HashMap<>(1); map.put("myKey", "myValue"); return QuartzUtils.createSimpleTrigger(jobDetail, "STName2", "STGroup2", "STDesc2", 10000L, 30000L, SimpleTrigger.REPEAT_INDEFINITELY, SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT, map, 1000); }
Example #14
Source File: SchedulerConfig.java From quartz-manager with Apache License 2.0 | 4 votes |
@Bean(name = "jobTrigger") public SimpleTriggerFactoryBean sampleJobTrigger(@Qualifier("jobDetail") JobDetail jobDetail, @Value("${job.frequency}") long frequency, @Value("${job.repeatCount}") int repeatCount) { return createTrigger(jobDetail, frequency, repeatCount); }
Example #15
Source File: TestContextConfiguration11.java From spring-boot-starter-quartz with Apache License 2.0 | 4 votes |
@Bean(name = "callbackJobTrigger3") public SimpleTriggerFactoryBean createCallbackTrigger3(@Qualifier("callbackJobDetail") JobDetail jobDetail) { return QuartzUtils.simpleTriggerBuilder().jobDetail(jobDetail).name("CallbackTrigger3").startDelay(5L) .repeatInterval(100L).repeatCount(20).getTriggerFactoryBean(); }
Example #16
Source File: TestContextConfiguration11.java From spring-boot-starter-quartz with Apache License 2.0 | 4 votes |
@Bean(name = "callbackJobTrigger2") public SimpleTriggerFactoryBean createCallbackTrigger2(@Qualifier("callbackJobDetail") JobDetail jobDetail) { return QuartzUtils.simpleTriggerBuilder().jobDetail(jobDetail).name("CallbackTrigger2").startDelay(5L) .repeatInterval(100L).repeatCount(20).getTriggerFactoryBean(); }
Example #17
Source File: TestContextConfiguration11.java From spring-boot-starter-quartz with Apache License 2.0 | 4 votes |
@Bean(name = "callbackJobTrigger") public SimpleTriggerFactoryBean createCallbackTrigger(@Qualifier("callbackJobDetail") JobDetail jobDetail) { return QuartzUtils.simpleTriggerBuilder().jobDetail(jobDetail).name("CallbackTrigger1").startDelay(5L) .repeatInterval(100L).repeatCount(20).getTriggerFactoryBean(); }
Example #18
Source File: TestContextConfiguration11.java From spring-boot-starter-quartz with Apache License 2.0 | 4 votes |
@Bean(name="simpleJobTrigger") public SimpleTriggerFactoryBean createSimpleTrigger(@Qualifier("simpleJobDetail") JobDetail jobDetail) { return QuartzUtils.createSimpleTrigger(jobDetail, null, null, "Simple trigger 1", 5000L, 60000L, null); }
Example #19
Source File: TestContextConfiguration4.java From spring-boot-starter-quartz with Apache License 2.0 | 4 votes |
@Bean(name="simpleJobTrigger") public SimpleTriggerFactoryBean createSimpleTrigger(@Qualifier("simpleJobDetail") JobDetail jobDetail) { return QuartzUtils.createSimpleTrigger(jobDetail, null, null, "Simple trigger 1", 5000L, 60000L, null); }
Example #20
Source File: QuartzUtils.java From spring-boot-starter-quartz with Apache License 2.0 | 4 votes |
public SimpleTriggerFactoryBean getTriggerFactoryBean() { return triggerFactoryBean; }
Example #21
Source File: QuartzUtils.java From spring-boot-starter-quartz with Apache License 2.0 | 4 votes |
/** * creates a simple trigger builder. you have to call {@link #build()} afterwards to get the object */ public QuartzSimpleTriggerBuilder() { triggerFactoryBean = new SimpleTriggerFactoryBean(); }
Example #22
Source File: TaskTrigger.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public SimpleTriggerFactoryBean getSimpleTrigger() { return simpleTrigger; }
Example #23
Source File: QuartzUtils.java From spring-boot-starter-quartz with Apache License 2.0 | 3 votes |
/** * <br><br> * <code> * {@literal @}Bean<br> * public SimpleTriggerFactoryBean createSimpleTrigger({@literal @}Qualifier("simpleJobDetail") JobDetail jobDetail) {<br> * return QuartzJobUtils.createSimpleTrigger(jobDetail, null, null, "Simple trigger 1", 5000L, 60000L, SimpleTrigger.REPEAT_INDEFINITELY, * SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT, null, 1 );<br> * }<br> * </code> * * @param jobDetail * @param triggerName (optional) * @param triggerGroup (optional) * @param triggerDescription (optional) * @param startDelay * @param repeatInterval for infinity: {@link SimpleTrigger#REPEAT_INDEFINITELY} * @param repeatCount * @param misfireInstruction {@link SimpleTrigger} * @param jobData (optional) * @param priority * @return */ public static SimpleTriggerFactoryBean createSimpleTrigger( JobDetail jobDetail, String triggerName, String triggerGroup, String triggerDescription, long startDelay, long repeatInterval, int repeatCount, int misfireInstruction, Map<String, ?> jobData, int priority) { return QuartzUtils.simpleTriggerBuilder().jobDetail(jobDetail).name(triggerName).group(triggerGroup) .description(triggerDescription).startDelay(startDelay).repeatInterval(repeatInterval) .repeatCount(repeatCount).misfireInstruction(misfireInstruction).putJobData(jobData).priority(priority) .getTriggerFactoryBean(); }
Example #24
Source File: QuartzUtils.java From spring-boot-starter-quartz with Apache License 2.0 | 3 votes |
/** * creates a SimpleTriggerFactoryBean regarding the parameters with {@link SimpleTrigger#REPEAT_INDEFINITELY} and * {@link SimpleTrigger#MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT} * * @see QuartzUtils#createSimpleTrigger(JobDetail, String, String, String, long, long, int, int, Map, int) * * @param jobDetail * @param triggerName (optional) * @param triggerGroup (optional) * @param triggerDescription (optional) * @param startDelay * @param repeatInterval * @param jobData (optional) * @return */ public static SimpleTriggerFactoryBean createSimpleTrigger(JobDetail jobDetail, String triggerName, String triggerGroup, String triggerDescription, long startDelay, long repeatInterval, Map<String, ?> jobData) { return QuartzUtils.simpleTriggerBuilder().jobDetail(jobDetail).name(triggerName).group(triggerGroup) .description(triggerDescription).startDelay(startDelay).repeatInterval(repeatInterval) .repeatCount(SimpleTrigger.REPEAT_INDEFINITELY) .misfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT) .putJobData(jobData).getTriggerFactoryBean(); }