Java Code Examples for org.springframework.scheduling.quartz.SimpleTriggerFactoryBean#setRepeatInterval()

The following examples show how to use org.springframework.scheduling.quartz.SimpleTriggerFactoryBean#setRepeatInterval() . 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 vote down vote up
/**
     *注意 参数 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 2
Source File: QuartzConfig.java    From MyCommunity with Apache License 2.0 5 votes vote down vote up
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 3
Source File: QuartzConfigration.java    From Tbed with GNU Affero General Public License v3.0 5 votes vote down vote up
@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 4
Source File: BlobStorageConfiguration.java    From mojito with Apache License 2.0 5 votes vote down vote up
@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 5
Source File: AssetExtractionCleanupJob.java    From mojito with Apache License 2.0 5 votes vote down vote up
@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 6
Source File: PollableTaskCleanupJob.java    From mojito with Apache License 2.0 5 votes vote down vote up
@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 7
Source File: PluralFormUpdaterJob.java    From mojito with Apache License 2.0 5 votes vote down vote up
@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 8
Source File: SchedulerConfig.java    From quartz-manager with Apache License 2.0 5 votes vote down vote up
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;
}