Java Code Examples for org.springframework.scheduling.quartz.CronTriggerFactoryBean#setGroup()

The following examples show how to use org.springframework.scheduling.quartz.CronTriggerFactoryBean#setGroup() . 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: Neutron.java    From Milkomeda with MIT License 5 votes vote down vote up
/**
 * cron表达式触发器
 * @param triggerName 触发器名称
 * @param triggerGroup 触发器所在组
 * @param cronExpression cron表达式
 * @return CronTrigger
 * @throws ParseException cron解析异常
 */
public static CronTrigger createCronTrigger(String triggerName, String triggerGroup, String cronExpression) throws ParseException {
    CronTriggerFactoryBean factoryBean = new CronTriggerFactoryBean();
    factoryBean.setName(triggerName);
    factoryBean.setGroup(triggerGroup);
    factoryBean.setCronExpression(cronExpression);
    // 由于是手动创建的Bean,需要调用afterPropertiesSet()属性初始化方法
    factoryBean.afterPropertiesSet();
    return factoryBean.getObject();
}
 
Example 2
Source File: SchedulerConfig.java    From zkdoctor with Apache License 2.0 5 votes vote down vote up
/**
 * 创建cron触发器
 *
 * @param jobDetail      job信息
 * @param cronExpression cron表达式
 * @param triggerName    触发器名称
 * @param triggerGroup   触发器组
 * @return
 */
private CronTriggerFactoryBean createCronTrigger(JobDetail jobDetail, String cronExpression,
                                                 String triggerName, String triggerGroup) {
    CronTriggerFactoryBean factoryBean = new CronTriggerFactoryBean();
    factoryBean.setJobDetail(jobDetail);
    factoryBean.setName(triggerName);
    factoryBean.setGroup(triggerGroup);
    factoryBean.setCronExpression(cronExpression);
    factoryBean.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOW);
    return factoryBean;
}
 
Example 3
Source File: QuartzConfiguration.java    From multiapps-controller with Apache License 2.0 5 votes vote down vote up
@Inject
@Bean
public CronTriggerFactoryBean cleanUpCronTriggerFactoryBean(ApplicationConfiguration configuration) {
    CronTriggerFactoryBean factory = new CronTriggerFactoryBean();
    factory.setJobDetail(cleanUpJobDetail().getObject());
    factory.setCronExpression(configuration.getCronExpressionForOldData());
    factory.setMisfireInstruction(org.quartz.CronTrigger.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW);
    factory.setGroup(TRIGGER_GROUP);
    factory.setName(CLEAN_UP_TRIGGER_NAME);
    return factory;
}
 
Example 4
Source File: QuartzConfig.java    From lemonaid with MIT License 5 votes vote down vote up
@Bean
public CronTriggerFactoryBean gravatarTrigger() {
	CronTriggerFactoryBean cronTriggerFactoryBean = new CronTriggerFactoryBean();
	cronTriggerFactoryBean.setJobDetail(gravatarJob().getObject());
	cronTriggerFactoryBean.setCronExpression("0 30 * * * ?"); // Every hour
	cronTriggerFactoryBean.setGroup("lemonaid-quartz");
	return cronTriggerFactoryBean;
}
 
Example 5
Source File: QuartzConfig.java    From lemonaid with MIT License 5 votes vote down vote up
@Bean
public CronTriggerFactoryBean locationTrigger() {
	CronTriggerFactoryBean cronTriggerFactoryBean = new CronTriggerFactoryBean();
	cronTriggerFactoryBean.setJobDetail(locationJob().getObject());
	cronTriggerFactoryBean.setCronExpression("0 15 0 * * ?"); // Every day
	cronTriggerFactoryBean.setGroup("lemonaid-quartz");
	return cronTriggerFactoryBean;
}
 
Example 6
Source File: QuartzConfig.java    From lemonaid with MIT License 5 votes vote down vote up
@Bean
public CronTriggerFactoryBean insideTrackTrigger() {
	CronTriggerFactoryBean cronTriggerFactoryBean = new CronTriggerFactoryBean();
	cronTriggerFactoryBean.setJobDetail(insideTrackJob().getObject());
	cronTriggerFactoryBean.setCronExpression("0 0 * * * ?"); // Every hour
	cronTriggerFactoryBean.setGroup("lemonaid-quartz");
	return cronTriggerFactoryBean;
}