Browse Source

线程池及处理频率调整

zhouy 5 years ago
parent
commit
fa6aa33483

+ 1 - 1
pom.xml

@@ -6,7 +6,7 @@
 	<groupId>com.uas.eis</groupId>
 	<artifactId>uas-eis</artifactId>
 	<version>0.0.1-SNAPSHOT</version>
-	<packaging>war</packaging>
+	<packaging>jar</packaging>
 
 	<name>uas-eis</name>
 	<description>uas external interaction system</description>

+ 2 - 2
src/main/java/com/uas/eis/core/config/AsyncConfig.java

@@ -19,9 +19,9 @@ public class AsyncConfig{
     public Executor asyncExecutor() {
         ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
         //核心线程数10:线程池创建时候初始化的线程数
-        executor.setCorePoolSize(2);
+        executor.setCorePoolSize(10);
         //最大线程数20:线程池最大的线程数,只有在缓冲队列满了之后才会申请超过核心线程数的线程
-        executor.setMaxPoolSize(2);
+        executor.setMaxPoolSize(50);
         //缓冲队列500:用来缓冲执行任务的队列
         executor.setQueueCapacity(500);
         //允许线程的空闲时间60秒:当超过了核心线程出之外的线程在空闲时间到达之后会被销毁

+ 1 - 1
src/main/java/com/uas/eis/task/DataDealTask.java

@@ -28,7 +28,7 @@ public class DataDealTask {
     @Autowired
     DataDealService dataDealService;
 
-    @Scheduled(cron = "0 0/10 * * * ?")
+    @Scheduled(cron = "0 0/5 * * * ?")
     public void dataDeal() {
         List<DataChip> dataChips = baseDao.getJdbcTemplate().query("select id_,chipcode_,counterpath_,datapath_,testdate_ from (select id_,chipcode_,counterpath_,datapath_,testdate_ from datacenter$chip where  nvl(readstatus_,0)=0 and testdate_ is  not null order by testdate_  desc) where rownum<=50",
                 new BeanPropertyRowMapper<DataChip>(DataChip.class));