Java Code Examples for org.springframework.scheduling.quartz.JobDetailFactoryBean#setDurability()

The following examples show how to use org.springframework.scheduling.quartz.JobDetailFactoryBean#setDurability() . 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: JobUtil.java    From spring-boot-quartz-demo with MIT License 7 votes vote down vote up
/**
 * 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();
}
 
Example 2
Source File: QuartzConfig.java    From lemonaid with MIT License 5 votes vote down vote up
@Bean
public JobDetailFactoryBean insideTrackJob() {
	JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
	jobDetailFactory.setJobClass(InsideTrackJob.class);
	jobDetailFactory.setGroup("lemonaid-quartz");
	jobDetailFactory.setDurability(true);
	return jobDetailFactory;
}
 
Example 3
Source File: SpringQrtzScheduler.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public JobDetailFactoryBean jobDetail() {

    JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
    jobDetailFactory.setJobClass(SampleJob.class);
    jobDetailFactory.setName("Qrtz_Job_Detail");
    jobDetailFactory.setDescription("Invoke Sample Job service...");
    jobDetailFactory.setDurability(true);
    return jobDetailFactory;
}
 
Example 4
Source File: RepositoryManualScreenshotRunJob.java    From mojito with Apache License 2.0 5 votes vote down vote up
@Bean(name = "repositoryManualScreenshotRun")
public JobDetailFactoryBean jobDetailRepositoryManualScreenshotRunJob() {
    JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
    jobDetailFactory.setJobClass(RepositoryManualScreenshotRunJob.class);
    jobDetailFactory.setDescription("One time update of manual screenshot run on repository objects");
    jobDetailFactory.setDurability(true);
    return jobDetailFactory;
}
 
Example 5
Source File: SlaCheckerCronJob.java    From mojito with Apache License 2.0 5 votes vote down vote up
@Bean(name = "slaCheckerCron")
public JobDetailFactoryBean jobDetailSlaCheckerCronJob() {
    JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
    jobDetailFactory.setJobClass(SlaCheckerCronJob.class);
    jobDetailFactory.setDescription("Check for incident related to SLA");
    jobDetailFactory.setDurability(true);
    return jobDetailFactory;
}
 
Example 6
Source File: PluralFormUpdaterJob.java    From mojito with Apache License 2.0 5 votes vote down vote up
@Bean(name = "jobDetailPluralFromUpdater")
JobDetailFactoryBean jobDetailPluralFromUpdater() {
    JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
    jobDetailFactory.setJobClass(PluralFormUpdaterJob.class);
    jobDetailFactory.setDescription("Update plural forms in text units");
    jobDetailFactory.setDurability(true);
    return jobDetailFactory;
}
 
Example 7
Source File: PollableTaskCleanupJob.java    From mojito with Apache License 2.0 5 votes vote down vote up
@Bean(name = "jobDetailPollableTaskCleanup")
public JobDetailFactoryBean jobDetailPollableTaskCleanup() {
    JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
    jobDetailFactory.setJobClass(PollableTaskCleanupJob.class);
    jobDetailFactory.setDescription(FINISH_ZOMBIE_TASKS_WITH_ERROR);
    jobDetailFactory.setDurability(true);
    return jobDetailFactory;
}
 
Example 8
Source File: AssetExtractionCleanupJob.java    From mojito with Apache License 2.0 5 votes vote down vote up
@Bean(name = "jobDetailAssetExtractionCleanup")
public JobDetailFactoryBean jobDetailAssetExtractionCleanup() {
    JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
    jobDetailFactory.setJobClass(AssetExtractionCleanupJob.class);
    jobDetailFactory.setDescription("Cleanup old asset extraction");
    jobDetailFactory.setDurability(true);
    return jobDetailFactory;
}
 
Example 9
Source File: RepositoryStatisticsCronJob.java    From mojito with Apache License 2.0 5 votes vote down vote up
@Bean(name = "repositoryStatisticsCron")
public JobDetailFactoryBean jobDetailRepositoryStatisticsCron() {
    JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
    jobDetailFactory.setJobClass(RepositoryStatisticsCronJob.class);
    jobDetailFactory.setDescription("Mark repository as out of data to later recompute stats");
    jobDetailFactory.setDurability(true);
    return jobDetailFactory;
}
 
Example 10
Source File: BlobStorageConfiguration.java    From mojito with Apache License 2.0 5 votes vote down vote up
@Bean(name = "jobDetailDatabaseBlobStorageCleanupJob")
public JobDetailFactoryBean jobDetailExpiringBlobCleanup() {
    JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
    jobDetailFactory.setJobClass(DatabaseBlobStorageCleanupJob.class);
    jobDetailFactory.setDescription("Cleanup expired blobs");
    jobDetailFactory.setDurability(true);
    return jobDetailFactory;
}
 
Example 11
Source File: QuartzConfig.java    From MyCommunity with Apache License 2.0 5 votes vote down vote up
public JobDetailFactoryBean alphaJobDetail () {
    JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
    factoryBean.setJobClass(AlphaJob.class);  // 管理的Job
    factoryBean.setName("alphaJob");
    factoryBean.setGroup("alphaGroup");
    factoryBean.setDurability(true);  // 任务是否持久保存
    factoryBean.setRequestsRecovery(true);  // 任务发生错误时是否可恢复

    return factoryBean;
}
 
Example 12
Source File: QuartzConfig.java    From lemonaid with MIT License 5 votes vote down vote up
@Bean
public JobDetailFactoryBean locationJob() {
	JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
	jobDetailFactory.setJobClass(LocationJob.class);
	jobDetailFactory.setGroup("lemonaid-quartz");
	jobDetailFactory.setDurability(true);
	return jobDetailFactory;
}
 
Example 13
Source File: QuartzConfig.java    From lemonaid with MIT License 5 votes vote down vote up
@Bean
public JobDetailFactoryBean gravatarJob() {
	JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
	jobDetailFactory.setJobClass(GravatarJob.class);
	jobDetailFactory.setGroup("lemonaid-quartz");
	jobDetailFactory.setDurability(true);
	return jobDetailFactory;
}
 
Example 14
Source File: SchedulerConfig.java    From ehousechina with Apache License 2.0 5 votes vote down vote up
@Bean(name = "sampleJobDetail")
public JobDetailFactoryBean sampleJobDetail() {
	JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
	factoryBean.setJobClass(ProcessJob.class);
	factoryBean.setDurability(true);
	return factoryBean;
}
 
Example 15
Source File: QuartzConfiguration.java    From multiapps-controller with Apache License 2.0 5 votes vote down vote up
@Bean
public JobDetailFactoryBean cleanUpJobDetail() {
    JobDetailFactoryBean factory = new JobDetailFactoryBean();
    factory.setJobClass(CleanUpJob.class);
    factory.setDurability(true);
    return factory;
}
 
Example 16
Source File: SchedulerConfig.java    From zkdoctor with Apache License 2.0 5 votes vote down vote up
/**
 * 创建jboDetail信息
 *
 * @param jobClass job类
 * @return
 */
private JobDetailFactoryBean createJobDetail(Class jobClass, String keyName, String group) {
    JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
    factoryBean.setJobClass(jobClass);
    factoryBean.setDurability(true);
    factoryBean.setName(keyName);
    factoryBean.setGroup(group);
    return factoryBean;
}
 
Example 17
Source File: PacmanQuartzConfiguration.java    From pacbot with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public JobDetailFactoryBean createJobDetail(Class jobClass) {
	JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
	factoryBean.setJobClass(jobClass);
	// job has to be durable to be stored in DB:
	factoryBean.setDurability(true);
	return factoryBean;
}
 
Example 18
Source File: QuartzConfig.java    From MyCommunity with Apache License 2.0 5 votes vote down vote up
public JobDetailFactoryBean postScoreRefreshJobDetail() {
    JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
    factoryBean.setJobClass(PostScoreRefreshJob.class);
    factoryBean.setName("postScoreRefreshJob");
    factoryBean.setGroup("communityJobGroup");
    factoryBean.setDurability(true);
    factoryBean.setRequestsRecovery(true);
    return factoryBean;
}
 
Example 19
Source File: SchedulerConfig.java    From quartz-manager with Apache License 2.0 4 votes vote down vote up
private static JobDetailFactoryBean createJobDetail(Class<? extends Job> jobClass) {
	JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
	factoryBean.setJobClass(jobClass);
	factoryBean.setDurability(false);
	return factoryBean;
}