admin
2024-10-15 6d313a4a6f9f9d7ea65ec50ab0d4491e595edb97
提交 | 用户 | 时间
e57a89 1 //package com.jcdm.quartz.config;
2 //
3 //import org.springframework.context.annotation.Bean;
4 //import org.springframework.context.annotation.Configuration;
5 //import org.springframework.scheduling.quartz.SchedulerFactoryBean;
6 //import javax.sql.DataSource;
7 //import java.util.Properties;
8 //
9 ///**
10 // * 定时任务配置(单机部署建议删除此类和qrtz数据库表,默认走内存会最高效)
11 // * 
12 // * @author jc
13 // */
14 //@Configuration
15 //public class ScheduleConfig
16 //{
17 //    @Bean
18 //    public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource)
19 //    {
20 //        SchedulerFactoryBean factory = new SchedulerFactoryBean();
21 //        factory.setDataSource(dataSource);
22 //
23 //        // quartz参数
24 //        Properties prop = new Properties();
25 //        prop.put("org.quartz.scheduler.instanceName", "RuoyiScheduler");
26 //        prop.put("org.quartz.scheduler.instanceId", "AUTO");
27 //        // 线程池配置
28 //        prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
29 //        prop.put("org.quartz.threadPool.threadCount", "20");
30 //        prop.put("org.quartz.threadPool.threadPriority", "5");
31 //        // JobStore配置
32 //        prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore");
33 //        // 集群配置
34 //        prop.put("org.quartz.jobStore.isClustered", "true");
35 //        prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
36 //        prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "10");
37 //        prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true");
38 //
39 //        // sqlserver 启用
40 //        // prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
41 //        prop.put("org.quartz.jobStore.misfireThreshold", "12000");
42 //        prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
43 //        factory.setQuartzProperties(prop);
44 //
45 //        factory.setSchedulerName("RuoyiScheduler");
46 //        // 延时启动
47 //        factory.setStartupDelay(1);
48 //        factory.setApplicationContextSchedulerContextKey("applicationContextKey");
49 //        // 可选,QuartzScheduler
50 //        // 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了
51 //        factory.setOverwriteExistingJobs(true);
52 //        // 设置自动启动,默认为true
53 //        factory.setAutoStartup(true);
54 //
55 //        return factory;
56 //    }
57 //}