|
@@ -1,57 +1,57 @@
|
|
|
-package com.ruoyi.quartz.config;
|
|
|
-
|
|
|
-import org.springframework.context.annotation.Bean;
|
|
|
-import org.springframework.context.annotation.Configuration;
|
|
|
-import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
|
|
-import javax.sql.DataSource;
|
|
|
-import java.util.Properties;
|
|
|
-
|
|
|
-
|
|
|
- * 定时任务配置(单机部署建议删除此类和qrtz数据库表,默认走内存会最高效)
|
|
|
- *
|
|
|
- * @author ruoyi
|
|
|
- */
|
|
|
-@Configuration
|
|
|
-public class ScheduleConfig
|
|
|
-{
|
|
|
- @Bean
|
|
|
- public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource)
|
|
|
- {
|
|
|
- SchedulerFactoryBean factory = new SchedulerFactoryBean();
|
|
|
- factory.setDataSource(dataSource);
|
|
|
-
|
|
|
-
|
|
|
- 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");
|
|
|
-
|
|
|
- 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");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- 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");
|
|
|
-
|
|
|
-
|
|
|
- factory.setOverwriteExistingJobs(true);
|
|
|
-
|
|
|
- factory.setAutoStartup(true);
|
|
|
-
|
|
|
- return factory;
|
|
|
- }
|
|
|
-}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|