本文整理汇总了Java中org.springframework.scheduling.quartz.CronTriggerBean.setCronExpression方法的典型用法代码示例。如果您正苦于以下问题:Java CronTriggerBean.setCronExpression方法的具体用法?Java CronTriggerBean.setCronExpression怎么用?Java CronTriggerBean.setCronExpression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.scheduling.quartz.CronTriggerBean
的用法示例。
在下文中一共展示了CronTriggerBean.setCronExpression方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: registerJob
import org.springframework.scheduling.quartz.CronTriggerBean; //导入方法依赖的package包/类
private void registerJob(final String jobName,
final Job jobInstance, final String cronExpression)
throws Exception {
// 0. unregister job
unregisterJob(jobName);
// 1. Job bean
getBeanFactory().registerSingleton(jobName, jobInstance);
// 2. JobDetail bean
JobDetail jobDetail = new JobDetailBean();
jobDetail.setName(jobName);
jobDetail.setGroup(Scheduler.DEFAULT_GROUP);
jobDetail.setJobClass(jobInstance.getClass());
// 3. Trigger
if (cronExpression == null) {
scheduler.getScheduler().addJob(jobDetail, true);
} else {
CronTriggerBean cronTrigger = new CronTriggerBean();
cronTrigger.setName(getTriggerName(jobName));
cronTrigger.setCronExpression(cronExpression);
scheduler.getScheduler().scheduleJob(jobDetail, cronTrigger);
}
}
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:28,代码来源:JobInstanceLoader.java示例3: getCronTriggerBean
import org.springframework.scheduling.quartz.CronTriggerBean; //导入方法依赖的package包/类
private CronTriggerBean getCronTriggerBean(String jobName, String cronExpression) {
CronTriggerBean cronTriggerBean = new CronTriggerBean();
cronTriggerBean.setName(jobName + TRIGGER_SFX);
try {
cronTriggerBean.setCronExpression(cronExpression);
} catch (ParseException e) {
LOG.error("Error while parsing cron expression :: " + cronExpression, e);
throw new RuntimeException("Error while parsing cron expression", e);
}
cronTriggerBean.setJobName(OLEConstants.OLEBatchProcess.BATCH_JOB + jobName);
cronTriggerBean.setJobGroup(SCHEDULED_GROUP);
return cronTriggerBean;
}
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:14,代码来源:OLEBatchSchedulerServiceImpl.java示例4: 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示例5: init
import org.springframework.scheduling.quartz.CronTriggerBean; //导入方法依赖的package包/类
@Override
public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) throws Exception {
ComponentInfo info = new ComponentInfo(Trigger.class, getClassifier());
final Map<String, Object> jobDataAsMap = Maps.newHashMap();
jobDataAsMap.put("observationTime", getObservationTime());
if (getDataSource() != null) {
jobDataAsMap.put("dataSource", getDataSource());
}
if (getNormalizationRuleSetId() != null) {
jobDataAsMap.put("normalizationRuleSetId", getNormalizationRuleSetId());
}
if (getDataFieldBlackList() != null) {
jobDataAsMap.put("dataFieldBlackList", createBlackList(getDataFieldBlackList(), "RedisDataFieldBlackList"));
}
if (getSchemeBlackList() != null) {
jobDataAsMap.put("schemeBlackList", createBlackList(getSchemeBlackList(), "RedisSchemeBlackList"));
}
if (getGlobalPrefix() != null) {
jobDataAsMap.put("globalPrefix", getGlobalPrefix());
}
if (getHtsMaster() != null) {
jobDataAsMap.put("htsMaster", getHtsMaster());
}
if (getRedisConnector() != null) {
jobDataAsMap.put("redisConnector", getRedisConnector());
}
if (getBaseDir() != null) {
jobDataAsMap.put("baseDir", getBaseDir());
}
CronTriggerBean cronTriggerBean = new CronTriggerBean();
cronTriggerBean.setBeanName(getName());
cronTriggerBean.setCronExpression(getCronExpression());
cronTriggerBean.setJobDataAsMap(jobDataAsMap);
cronTriggerBean.setJobName(getJobName());
if (getJobGroup() != null) {
cronTriggerBean.setJobGroup(getJobGroup());
}
cronTriggerBean.afterPropertiesSet();
repo.registerComponent(info, cronTriggerBean);
Scheduler scheduler = getScheduler();
scheduler.scheduleJob(cronTriggerBean);
}
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:48,代码来源:CronTriggerComponentFactory.java示例6: 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
setCronExpression:setCronExpression