forked from yangzongzhuan/RuoYi-Cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a112c7
commit b1a67a1
Showing
7 changed files
with
78 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 57 additions & 57 deletions
114
ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/config/ScheduleConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
package com.ruoyi.job.config; | ||
|
||
import java.util.Properties; | ||
import javax.sql.DataSource; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.quartz.SchedulerFactoryBean; | ||
|
||
/** | ||
* 定时任务配置(单机部署建议删除此类和qrtz数据库表,默认走内存会最高效) | ||
* | ||
* @author ruoyi | ||
*/ | ||
@Configuration | ||
public class ScheduleConfig | ||
{ | ||
@Bean | ||
public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) | ||
{ | ||
SchedulerFactoryBean factory = new SchedulerFactoryBean(); | ||
factory.setDataSource(dataSource); | ||
|
||
// quartz参数 | ||
Properties prop = new Properties(); | ||
prop.put("org.quartz.scheduler.instanceName", "RuoyiScheduler"); | ||
prop.put("org.quartz.scheduler.instanceId", "AUTO"); | ||
// 线程池配置 | ||
prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool"); | ||
prop.put("org.quartz.threadPool.threadCount", "20"); | ||
prop.put("org.quartz.threadPool.threadPriority", "5"); | ||
// JobStore配置 | ||
prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore"); | ||
// 集群配置 | ||
prop.put("org.quartz.jobStore.isClustered", "true"); | ||
prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000"); | ||
prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1"); | ||
prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true"); | ||
|
||
// sqlserver 启用 | ||
// prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?"); | ||
prop.put("org.quartz.jobStore.misfireThreshold", "12000"); | ||
prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_"); | ||
factory.setQuartzProperties(prop); | ||
|
||
factory.setSchedulerName("RuoyiScheduler"); | ||
// 延时启动 | ||
factory.setStartupDelay(1); | ||
factory.setApplicationContextSchedulerContextKey("applicationContextKey"); | ||
// 可选,QuartzScheduler | ||
// 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了 | ||
factory.setOverwriteExistingJobs(true); | ||
// 设置自动启动,默认为true | ||
factory.setAutoStartup(true); | ||
|
||
return factory; | ||
} | ||
} | ||
//package com.ruoyi.job.config; | ||
// | ||
//import java.util.Properties; | ||
//import javax.sql.DataSource; | ||
//import org.springframework.context.annotation.Bean; | ||
//import org.springframework.context.annotation.Configuration; | ||
//import org.springframework.scheduling.quartz.SchedulerFactoryBean; | ||
// | ||
///** | ||
// * 定时任务配置(单机部署建议删除此类和qrtz数据库表,默认走内存会最高效) | ||
// * | ||
// * @author ruoyi | ||
// */ | ||
//@Configuration | ||
//public class ScheduleConfig | ||
//{ | ||
// @Bean | ||
// public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) | ||
// { | ||
// SchedulerFactoryBean factory = new SchedulerFactoryBean(); | ||
// factory.setDataSource(dataSource); | ||
// | ||
// // quartz参数 | ||
// Properties prop = new Properties(); | ||
// prop.put("org.quartz.scheduler.instanceName", "RuoyiScheduler"); | ||
// prop.put("org.quartz.scheduler.instanceId", "AUTO"); | ||
// // 线程池配置 | ||
// prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool"); | ||
// prop.put("org.quartz.threadPool.threadCount", "20"); | ||
// prop.put("org.quartz.threadPool.threadPriority", "5"); | ||
// // JobStore配置 | ||
// prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore"); | ||
// // 集群配置 | ||
// prop.put("org.quartz.jobStore.isClustered", "true"); | ||
// prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000"); | ||
// prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1"); | ||
// prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true"); | ||
// | ||
// // sqlserver 启用 | ||
// // prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?"); | ||
// prop.put("org.quartz.jobStore.misfireThreshold", "12000"); | ||
// prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_"); | ||
// factory.setQuartzProperties(prop); | ||
// | ||
// factory.setSchedulerName("RuoyiScheduler"); | ||
// // 延时启动 | ||
// factory.setStartupDelay(1); | ||
// factory.setApplicationContextSchedulerContextKey("applicationContextKey"); | ||
// // 可选,QuartzScheduler | ||
// // 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了 | ||
// factory.setOverwriteExistingJobs(true); | ||
// // 设置自动启动,默认为true | ||
// factory.setAutoStartup(true); | ||
// | ||
// return factory; | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters