Java CronTriggerBean.setJobDetail方法代码示例

本文整理汇总了Java中org.springframework.scheduling.quartz.CronTriggerBean.setJobDetail方法的典型用法代码示例。如果您正苦于以下问题:Java CronTriggerBean.setJobDetail方法的具体用法?Java CronTriggerBean.setJobDetail怎么用?Java CronTriggerBean.setJobDetail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.scheduling.quartz.CronTriggerBean的用法示例。


Java CronTriggerBean.setJobDetail方法代码示例

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

示例1: scheduleReport

import org.springframework.scheduling.quartz.CronTriggerBean; //导入方法依赖的package包/类
private void scheduleReport(ReportDefinition reportDef) throws ClassNotFoundException, NoSuchMethodException, ParseException, SchedulerException, Exception {
    
    //this is most likely reentrant since the method is private and called from start via plural version.
    synchronized (m_scheduler) {
        
        MethodInvokingJobDetailFactoryBean jobFactory = new MethodInvokingJobDetailFactoryBean();
        jobFactory.setTargetObject(this);
        jobFactory.setTargetMethod("runReport");
        jobFactory.setArguments(new Object[] { reportDef });
        jobFactory.setConcurrent(false);
        jobFactory.setBeanName(reportDef.getDescription());
        jobFactory.afterPropertiesSet();
        JobDetail jobDetail = (JobDetail) jobFactory.getObject();
        
        CronTriggerBean cronReportTrigger = new CronTriggerBean();
        cronReportTrigger.setBeanName(reportDef.getDescription());
        cronReportTrigger.setJobDetail(jobDetail);
        cronReportTrigger.setCronExpression(reportDef.getCronExpression());
        cronReportTrigger.afterPropertiesSet();
        
        m_scheduler.scheduleJob(cronReportTrigger.getJobDetail(), cronReportTrigger);
        log().debug("Schedule report " + cronReportTrigger);
        
    }
} 
开发者ID:qoswork,项目名称:opennmszh,代码行数:26,代码来源:Statsd.java

示例2: jobDetailTrigger

import org.springframework.scheduling.quartz.CronTriggerBean; //导入方法依赖的package包/类
@Bean
public CronTrigger jobDetailTrigger() throws Exception {
	CronTriggerBean cronTriggerBean = new CronTriggerBean();
	cronTriggerBean.setBeanName("jobDetailTrigger");
	cronTriggerBean.setJobDetail(jobDetail());
	cronTriggerBean.setCronExpression("* * * * * ?");
	cronTriggerBean.afterPropertiesSet();
	return cronTriggerBean;
} 
开发者ID:debop,项目名称:spring-batch-experiments,代码行数:10,代码来源:QuartzSchedulingConfiguration.java

示例3: start

import org.springframework.scheduling.quartz.CronTriggerBean; //导入方法依赖的package包/类
public void start() throws Exception {
	LOG.info("start crontab");
	
	if (application.getCrontab() != null && application.getCrontab().getCrons() != null) {
		
		Trigger[] triggers = new Trigger[application.getCrontab().getCrons().size()];
		for (int i = 0; i < triggers.length; i ++) {
			
			Cron cron = application.getCrontab().getCrons().get(i);
			String desc = cron.getDescription();
			String exp = cron.getSchedule();
			String script = cron.getScript();
			
			MethodInvokingJobDetailFactoryBean jobDetailFactory = new MethodInvokingJobDetailFactoryBean();
			jobDetailFactory.setBeanName("jobDetail" + script);
			jobDetailFactory.setName("jobDetail" + script);
			jobDetailFactory.setTargetObject(this);
			jobDetailFactory.setTargetMethod("execute");
			jobDetailFactory.setArguments(new Object[]{script, exp, desc});
			jobDetailFactory.setConcurrent(application.getCrontab().isConcurrent());
			jobDetailFactory.afterPropertiesSet();
			
			JobDetail jobDetail = jobDetailFactory.getObject();

			CronTriggerBean trigger = new CronTriggerBean();
			trigger.setBeanName("trigger" + script);
			trigger.setName("trigger" + script);
			trigger.setJobDetail(jobDetail);
			trigger.setCronExpression(exp);
			trigger.afterPropertiesSet();
			
			triggers[i] = trigger;
		}

		Properties properties = new Properties();
		properties.setProperty("org.quartz.scheduler.skipUpdateCheck", "true");
		
		schedulerFactory = new SchedulerFactoryBean();
		schedulerFactory.setBeanName("schedulerFactory");
		schedulerFactory.setTriggers(triggers);
		schedulerFactory.setQuartzProperties(properties);
		//schedulerFactory.setAutoStartup(true);
		schedulerFactory.afterPropertiesSet();
		schedulerFactory.start();
	}
} 
开发者ID:lane-cn,项目名称:getty,代码行数:47,代码来源:CrontabManager.java

本文标签属性:

示例:示例志愿表

代码:代码大全可复制

java:java自行车

CronTriggerBean:CronTriggerBean

setJobDetail:setJobDetail

上一篇:1992年贵阳空中怪车事件,曾轰动全世界(贵州“空中怪车”事件,400亩树林数分钟内全折断,发生了什么?)
下一篇:酒后挖前妻父母坟墓(酒后挖前妻父母坟墓犯法吗)

为您推荐