当前位置: 首页>>代码示例>>Java>>正文


Java CronTriggerFactoryBean类代码示例

本文整理汇总了Java中org.springframework.scheduling.quartz.CronTriggerFactoryBean的典型用法代码示例。如果您正苦于以下问题:Java CronTriggerFactoryBean类的具体用法?Java CronTriggerFactoryBean怎么用?Java CronTriggerFactoryBean使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CronTriggerFactoryBean类属于org.springframework.scheduling.quartz包,在下文中一共展示了CronTriggerFactoryBean类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initTransferJob

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
public void initTransferJob(TransferJob transferJob) throws ClassNotFoundException, NoSuchMethodException, ParseException, SchedulerException {
	MethodInvokingJobDetailFactoryBean jobDetailFactory = new MethodInvokingJobDetailFactoryBean();
   	jobDetailFactory.setTargetObject(this);
   	jobDetailFactory.setTargetMethod("runReceiveJob");
   	jobDetailFactory.setConcurrent(false);
   	jobDetailFactory.setArguments(new Object[]{transferJob});
   	jobDetailFactory.setName(transferJob.getId() + "_job");
   	jobDetailFactory.afterPropertiesSet();
   	JobDetail jobDetail = jobDetailFactory.getObject();
   	
   	CronTriggerFactoryBean triggerFactory = new CronTriggerFactoryBean();
   	triggerFactory.setCronExpression(transferJob.getCronExpression());
   	triggerFactory.setName(transferJob.getName() + "_trigger");
   	triggerFactory.setJobDetail(jobDetail);
   	
   	triggerFactory.afterPropertiesSet();
   	scheduler.scheduleJob(jobDetail,triggerFactory.getObject());
   	LOGGER.debug("Transfer job: {}({}) initialized", transferJob.getName(),transferJob.getId());
}
 
开发者ID:northlander,项目名称:activemft,代码行数:20,代码来源:ReceiverService.java

示例2: afterPropertiesSet

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
@Override
public void afterPropertiesSet () throws Exception
{
   Map<String, AbstractJob> webappBeanNames =
      applicationContext.getBeansOfType (AbstractJob.class);
   triggers = new HashMap<> ();
   for (String webappBeanName : webappBeanNames.keySet ())
   {
      AbstractJob cron = webappBeanNames.get (webappBeanName);
      CronTriggerFactoryBean trigger = new CronTriggerFactoryBean ();
      JobDetail job = JobBuilder.newJob (cron.getClass ()).
         storeDurably (true).build ();
      trigger.setJobDetail (job);
      trigger.setCronExpression (cron.getCronExpression ());
      trigger.setName (webappBeanName + "Trigger");
      trigger.afterPropertiesSet ();
      triggers.put (cron.getClass(), trigger.getObject ());
   }
   super.setTriggers (triggers.values ().toArray (
      new Trigger[triggers.size ()]));
   super.setJobFactory (autowiringJobFactory);
   super.afterPropertiesSet ();
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:24,代码来源:JobScheduler.java

示例3: registerSchedulerTriggerBean

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
/**
 * 
 * @param acf
 * @param sch
 * @return
 */
private Trigger registerSchedulerTriggerBean(DefaultListableBeanFactory acf, AbstractJob sch) {
    //注册JobDetail
    String jobDetailBeanName = sch.getJobName() + "JobDetail";
    if (context.containsBean(jobDetailBeanName)) {
        throw new RuntimeException("duplicate jobName[" + sch.getJobName() + "] defined!!");
    }
    BeanDefinitionBuilder beanDefBuilder = BeanDefinitionBuilder
        .genericBeanDefinition(MethodInvokingJobDetailFactoryBean.class);
    beanDefBuilder.addPropertyValue("targetObject", sch);
    beanDefBuilder.addPropertyValue("targetMethod", "execute");
    beanDefBuilder.addPropertyValue("concurrent", false);
    acf.registerBeanDefinition(jobDetailBeanName, beanDefBuilder.getRawBeanDefinition());

    //注册Trigger
    String triggerBeanName = sch.getJobName() + "Trigger";
    beanDefBuilder = BeanDefinitionBuilder.genericBeanDefinition(CronTriggerFactoryBean.class);
    beanDefBuilder.addPropertyReference("jobDetail", jobDetailBeanName);
    beanDefBuilder.addPropertyValue("cronExpression", sch.getCronExpr());
    beanDefBuilder.addPropertyValue("group", groupName);
    acf.registerBeanDefinition(triggerBeanName, beanDefBuilder.getRawBeanDefinition());

    logger.info("register scheduler task [{}] ok!!", sch.getJobName());
    return (Trigger) context.getBean(triggerBeanName);

}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:32,代码来源:SchedulerFactoryBeanWrapper.java

示例4: build

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
public SchedulerFactoryBean build() throws Exception {
	SchedulerFactoryBean bean = new SchedulerFactoryBean();
	PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
	propertiesFactoryBean.setLocation(new ClassPathResource(config));
	propertiesFactoryBean.afterPropertiesSet();
	Properties props = propertiesFactoryBean.getObject();
	List<Trigger> triggers = Lists.newArrayList();
	List<JobModel> jobList = getJobs(props);
	for (JobModel job : jobList) {
		if (!job.isEnable()) {
			continue;
		}
		JobDetailFactoryBean detail = createJobDetail(job.getName(), Class.forName(job.getJob()));
		CronTriggerFactoryBean trigger = createCronTrigger(job.getName(), detail.getObject(), job.getCorn());
		CronTrigger t = trigger.getObject();
		triggers.add(t);
	}
	bean.setTriggers(triggers.toArray(new Trigger[0]));
	//bean.afterPropertiesSet();
	return bean;

}
 
开发者ID:mazhaoyong,项目名称:api-server-seed,代码行数:23,代码来源:QuartzFactory.java

示例5: registerSchedulerTriggerBean

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
/**
 * 
 * @param acf
 * @param sch
 * @return
 */
private Trigger registerSchedulerTriggerBean(DefaultListableBeanFactory acf,AbstractJob sch) {
	//注册JobDetail
	String jobDetailBeanName = sch.getJobName() + "JobDetail";
	if(context.containsBean(jobDetailBeanName)){
		throw new RuntimeException("duplicate jobName["+sch.getJobName()+"] defined!!");
	}
	BeanDefinitionBuilder beanDefBuilder = BeanDefinitionBuilder.genericBeanDefinition(MethodInvokingJobDetailFactoryBean.class);
	beanDefBuilder.addPropertyValue("targetObject", sch);
	beanDefBuilder.addPropertyValue("targetMethod", "execute");
	beanDefBuilder.addPropertyValue("concurrent", false);
	acf.registerBeanDefinition(jobDetailBeanName, beanDefBuilder.getRawBeanDefinition());
	
	//注册Trigger
	String triggerBeanName = sch.getJobName() + "Trigger";
	beanDefBuilder = BeanDefinitionBuilder.genericBeanDefinition(CronTriggerFactoryBean.class);
	beanDefBuilder.addPropertyReference("jobDetail", jobDetailBeanName);
	beanDefBuilder.addPropertyValue("cronExpression", sch.getCronExpr());
	beanDefBuilder.addPropertyValue("group", groupName);
	acf.registerBeanDefinition(triggerBeanName, beanDefBuilder.getRawBeanDefinition());
	
	return (Trigger) context.getBean(triggerBeanName);
	
}
 
开发者ID:vakinge,项目名称:jeesuite-libs,代码行数:30,代码来源:SchedulerFactoryBeanWrapper.java

示例6: cronJobTrigger

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
/** 
 * attention: 
 * Details:配置定时任务的触发器,也就是什么时候触发执行定时任务 
 */  
@Bean(name = "jobTrigger")  
public CronTriggerFactoryBean cronJobTrigger(MethodInvokingJobDetailFactoryBean jobDetail) {  
    CronTriggerFactoryBean tigger = new CronTriggerFactoryBean();  
    tigger.setJobDetail(jobDetail.getObject());  
    /*tigger.setCronExpression("0 30 20 * * ?");// 初始时的cron表达式   */        
    tigger.setCronExpression("59 39 17 * * ?"); //初始的时候cron表达式,每天的下午17:40:00准时调度
    tigger.setName("srd-chhliu");// trigger的name  
    return tigger;  
  
}
 
开发者ID:duanyaxin,项目名称:springboot-smart,代码行数:15,代码来源:QuartzConfigration.java

示例7: cronTriggerFactoryBean

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
@Bean(name = "cleanUpCronTriggerFactoryBean")
public CronTriggerFactoryBean cronTriggerFactoryBean() {
    com.sap.cloud.lm.sl.cf.core.util.Configuration configuration = com.sap.cloud.lm.sl.cf.core.util.Configuration.getInstance();
    CronTriggerFactoryBean factory = new CronTriggerFactoryBean();
    factory.setJobDetail(jobDetailFactoryBean().getObject());
    factory.setCronExpression(configuration.getCronExpressionForOldData());
    factory.setGroup(TRIGGER_GROUP);
    factory.setName(CLEAN_UP_TRIGGER_NAME);
    return factory;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:11,代码来源:QuartzAppContext.java

示例8: createSimpleCronTrigger2

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
@Bean(name="cronTrigger2")
public CronTriggerFactoryBean createSimpleCronTrigger2(@Qualifier("cronJobDetail") JobDetail jobDetail) {
	Map<String, Object> map = new HashMap<>(1);
	map.put("myKey", "myValue");
    return QuartzUtils.createCronTrigger(jobDetail, "CTName2", "Cron", "CTDesc2", "0 0 0/1 1/1 * ? *", 
    		CronTrigger.MISFIRE_INSTRUCTION_SMART_POLICY, map, 10000L, new Date(), "Europe/Berlin", 1234);
}
 
开发者ID:andrehertwig,项目名称:spring-boot-starter-quartz,代码行数:8,代码来源:TestContextConfiguration4.java

示例9: createCronTrigger

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
private CronTriggerFactoryBean createCronTrigger(String name, JobDetail jobDetail, String corn)
		throws ParseException {
	CronTriggerFactoryBean factoryBean = new CronTriggerFactoryBean();
	factoryBean.setName(name);
	factoryBean.setJobDetail(jobDetail);
	factoryBean.setCronExpression(corn);
	factoryBean.afterPropertiesSet();
	return factoryBean;
}
 
开发者ID:mazhaoyong,项目名称:api-server-seed,代码行数:10,代码来源:QuartzFactory.java

示例10: gravatarTrigger

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
@Bean
public CronTriggerFactoryBean gravatarTrigger() {
	CronTriggerFactoryBean cronTriggerFactoryBean = new CronTriggerFactoryBean();
	cronTriggerFactoryBean.setJobDetail(gravatarJob().getObject());
	cronTriggerFactoryBean.setCronExpression("0 30 * * * ?"); // Every hour
	cronTriggerFactoryBean.setGroup("lemonaid-quartz");
	return cronTriggerFactoryBean;
}
 
开发者ID:sapmentors,项目名称:lemonaid,代码行数:9,代码来源:QuartzConfig.java

示例11: locationTrigger

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
@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;
}
 
开发者ID:sapmentors,项目名称:lemonaid,代码行数:9,代码来源:QuartzConfig.java

示例12: insideTrackTrigger

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
@Bean
public CronTriggerFactoryBean insideTrackTrigger() {
	CronTriggerFactoryBean cronTriggerFactoryBean = new CronTriggerFactoryBean();
	cronTriggerFactoryBean.setJobDetail(insideTrackJob().getObject());
	cronTriggerFactoryBean.setCronExpression("0 0 * * * ?"); // Every hour
	cronTriggerFactoryBean.setGroup("lemonaid-quartz");
	return cronTriggerFactoryBean;
}
 
开发者ID:sapmentors,项目名称:lemonaid,代码行数:9,代码来源:QuartzConfig.java

示例13: QuartzCronTriggerBuilder

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
public QuartzCronTriggerBuilder() {
	triggerFactoryBean = new CronTriggerFactoryBean();
}
 
开发者ID:andrehertwig,项目名称:spring-boot-starter-quartz,代码行数:4,代码来源:QuartzUtils.java

示例14: createSimpleCronTrigger

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
@Bean(name="cronTrigger")
public CronTriggerFactoryBean createSimpleCronTrigger(@Qualifier("cronJobDetail") JobDetail jobDetail) {
    return QuartzUtils.createCronTrigger(jobDetail, null, "Cron", null, "0 0 0/1 1/1 * ? *", 5000L, null);
}
 
开发者ID:andrehertwig,项目名称:spring-boot-starter-quartz,代码行数:5,代码来源:TestContextConfiguration4.java

示例15: getTriggerFactoryBean

import org.springframework.scheduling.quartz.CronTriggerFactoryBean; //导入依赖的package包/类
/**
 * 
 * @return
 */
public CronTriggerFactoryBean getTriggerFactoryBean() {
	return triggerFactoryBean;
}
 
开发者ID:andrehertwig,项目名称:spring-boot-starter-quartz,代码行数:8,代码来源:QuartzUtils.java


注:本文中的org.springframework.scheduling.quartz.CronTriggerFactoryBean类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。