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


Java JobDetailFactoryBean类代码示例

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


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

示例1: build

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的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

示例2: createJob

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
/**
 * Create Quartz Job.
 * 
 * @param jobClass Class whose executeInternal() method needs to be called. 
 * @param isDurable Job needs to be persisted even after completion. if true, job will be persisted, not otherwise. 
 * @param context Spring application context.
 * @param jobName Job name.
 * @param jobGroup Job group.
 * 
 * @return JobDetail object
 */
protected static JobDetail createJob(Class<? extends QuartzJobBean> jobClass, boolean isDurable, 
		ApplicationContext context, String jobName, String jobGroup){
    JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
    factoryBean.setJobClass(jobClass);
    factoryBean.setDurability(isDurable);
    factoryBean.setApplicationContext(context);
    factoryBean.setName(jobName);
    factoryBean.setGroup(jobGroup);
       
    // set job data map
       JobDataMap jobDataMap = new JobDataMap();
       jobDataMap.put("myKey", "myValue");
       factoryBean.setJobDataMap(jobDataMap);
       
       factoryBean.afterPropertiesSet();
       
    return factoryBean.getObject();
}
 
开发者ID:javabypatel,项目名称:spring-boot-quartz-demo,代码行数:30,代码来源:JobUtil.java

示例3: autowireJobTest

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
/**
 * Test if Job instances are autowired with the required beans and the
 * method ingest is called at least once (the job has been executed).
 * 
 * @throws SchedulerException
 *             if there is any problem launching the job.
 * @throws InterruptedException
 *             if test is interrupted while waiting for the job to start.
 */
@Test
@DatabaseSetup("schedulerData.xml")
public void autowireJobTest() throws SchedulerException,
		InterruptedException {

	JobDetailFactoryBean jdFactory = new JobDetailFactoryBean();
	jdFactory.setName("jdFactory");
	jdFactory.setJobClass(IngestJob.class);
	Map<String, Object> jobDataMap = Maps.newHashMap();
	jobDataMap.put(IngestJob.INGEST_ID, Long.toString(10L));
	jdFactory.setJobDataAsMap(jobDataMap);
	jdFactory.afterPropertiesSet();
	JobDetail jobDetail = jdFactory.getObject();

	SimpleTrigger trigger = (SimpleTrigger) newTrigger()
			.withIdentity("jdFactory", "DEFAULT").forJob(jobDetail).build();

	schedulerFactoryBean.getScheduler().scheduleJob(jobDetail, trigger);
	Thread.sleep(5000L);
	// verify(metadataIngester, atLeastOnce()).ingest(any(Metadata.class));
}
 
开发者ID:OpenGeoportal,项目名称:ogpHarvester,代码行数:31,代码来源:SchedulerTest.java

示例4: jobDetailFactoryBean

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
@Bean(name = "cleanUpJobDetail")
public JobDetailFactoryBean jobDetailFactoryBean() {
    JobDetailFactoryBean factory = new JobDetailFactoryBean();
    factory.setJobClass(CleanUpJob.class);
    factory.setDurability(true);
    return factory;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:8,代码来源:QuartzAppContext.java

示例5: getMonitorJob

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
@Bean
@Scope(value = "prototype")
public JobDetailFactoryBean getMonitorJob(){
	JobDetailFactoryBean bean = new JobDetailFactoryBean();
	bean.setJobClass(NodeMonitorJob.class);
	return bean;
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:8,代码来源:MvcConfiguration.java

示例6: getEventJob

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
@Bean
@Scope(value = "prototype")
public JobDetailFactoryBean getEventJob(){
	JobDetailFactoryBean bean = new JobDetailFactoryBean();
	bean.setJobClass(EventJob.class);
	return bean;
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:8,代码来源:MvcConfiguration.java

示例7: createJobDetail

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
private JobDetailFactoryBean createJobDetail(String name, Class<?> jobClass) {
	JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
	factoryBean.setName(name);
	factoryBean.setJobClass(jobClass);
	factoryBean.setApplicationContext(context);
	factoryBean.setApplicationContextJobDataKey(AbstractJob.KEY_APPLICATION_CONTEXT);
	// job has to be durable to be stored in DB:
	factoryBean.setDurability(true);
	factoryBean.afterPropertiesSet();
	return factoryBean;
}
 
开发者ID:mazhaoyong,项目名称:api-server-seed,代码行数:12,代码来源:QuartzFactory.java

示例8: gravatarJob

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
@Bean
public JobDetailFactoryBean gravatarJob() {
	JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
	jobDetailFactory.setJobClass(GravatarJob.class);
	jobDetailFactory.setGroup("lemonaid-quartz");
	jobDetailFactory.setDurability(true);
	return jobDetailFactory;
}
 
开发者ID:sapmentors,项目名称:lemonaid,代码行数:9,代码来源:QuartzConfig.java

示例9: locationJob

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
@Bean
public JobDetailFactoryBean locationJob() {
	JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
	jobDetailFactory.setJobClass(LocationJob.class);
	jobDetailFactory.setGroup("lemonaid-quartz");
	jobDetailFactory.setDurability(true);
	return jobDetailFactory;
}
 
开发者ID:sapmentors,项目名称:lemonaid,代码行数:9,代码来源:QuartzConfig.java

示例10: insideTrackJob

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
@Bean
public JobDetailFactoryBean insideTrackJob() {
	JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
	jobDetailFactory.setJobClass(InsideTrackJob.class);
	jobDetailFactory.setGroup("lemonaid-quartz");
	jobDetailFactory.setDurability(true);
	return jobDetailFactory;
}
 
开发者ID:sapmentors,项目名称:lemonaid,代码行数:9,代码来源:QuartzConfig.java

示例11: createJobDetail

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
private JobDetail createJobDetail(final PiSchedule piSchedule) {
    final JobDetailFactoryBean jobDetailFactoryBean = new JobDetailFactoryBean();
    jobDetailFactoryBean.setApplicationContext(context);
    jobDetailFactoryBean.setName(piSchedule.getScheduleName());
    jobDetailFactoryBean.setJobClass(PiJob.class);
    jobDetailFactoryBean.getJobDataMap().put("piSchedule", piSchedule);
    jobDetailFactoryBean.afterPropertiesSet();

    return jobDetailFactoryBean.getObject();
}
 
开发者ID:justinhrobbins,项目名称:raspberry-pi-api,代码行数:11,代码来源:PiScheduleServiceImpl.java

示例12: createJobDetail

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
/**
 * Create a {@link JobDetail} based on the ingest passed as parameter.
 *
 * @param ingest the ingest to be scheduled.
 * @return a JobDetail base on the ingest passed.
 */
private JobDetail createJobDetail(Ingest ingest) {
    JobDetailFactoryBean jdFactory = new JobDetailFactoryBean();
    jdFactory.setName(generateJobName(ingest));
    jdFactory.setJobClass(IngestJob.class);
    jdFactory.getJobDataMap().put(IngestJob.INGEST_ID,
            ingest.getId().toString());
    jdFactory.afterPropertiesSet();
    return jdFactory.getObject();
}
 
开发者ID:OpenGeoportal,项目名称:ogpHarvester,代码行数:16,代码来源:IngestScheduler.java

示例13: QuartzJobBuilder

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

示例14: simpleJobDetail

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
@Bean(name="simpleJobDetail")
public JobDetailFactoryBean simpleJobDetail() {
	return QuartzUtils.createJobDetail(SimpleJob.class, SIMPLE_JOB_NAME, SIMPLE_JOB_GROUP, "Just a Simple Job", null);
}
 
开发者ID:andrehertwig,项目名称:spring-boot-starter-quartz,代码行数:5,代码来源:TestContextConfiguration4.java

示例15: cronJobDetail

import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入依赖的package包/类
@Bean(name="cronJobDetail")
public JobDetailFactoryBean cronJobDetail() {
	return QuartzUtils.createJobDetail(SimpleCronJob.class, CRON_JOB_NAME, CRON_JOB_GROUP, "Just a Cron Job", null);
}
 
开发者ID:andrehertwig,项目名称:spring-boot-starter-quartz,代码行数:5,代码来源:TestContextConfiguration4.java


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