Commit e96117ff031de15476ad07075cdde445a91779e8

Authored by 潘钊
1 parent 2ab5ad10

update...

src/main/java/com/bsth/Application.java
... ... @@ -11,7 +11,7 @@ import java.util.concurrent.ScheduledExecutorService;
11 11 @SpringBootApplication
12 12 public class Application extends SpringBootServletInitializer {
13 13  
14   - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(7);
  14 + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(8);
15 15  
16 16 @Override
17 17 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
... ...
src/main/java/com/bsth/StartCommand.java
1 1 package com.bsth;
2 2  
3 3  
  4 +import com.bsth.server_rs.thread.RfidCardInfoPersistenceThread;
4 5 import com.bsth.service.Line2SystemService;
5 6 import org.springframework.beans.factory.annotation.Autowired;
6 7 import org.springframework.boot.CommandLineRunner;
7 8 import org.springframework.stereotype.Component;
8 9  
  10 +import java.util.concurrent.ScheduledExecutorService;
  11 +import java.util.concurrent.TimeUnit;
  12 +
9 13  
10 14 /**
11 15 * 随应用启动运行
... ... @@ -18,6 +22,9 @@ public class StartCommand implements CommandLineRunner{
18 22 @Autowired
19 23 Line2SystemService line2SystemService;
20 24  
  25 + @Autowired
  26 + RfidCardInfoPersistenceThread rfidCardInfoPersistenceThread;
  27 +
21 28 @Override
22 29 public void run(String... arg0){
23 30  
... ... @@ -25,6 +32,9 @@ public class StartCommand implements CommandLineRunner{
25 32 //将增量的线路load到对照清单
26 33 line2SystemService.loadByLineInfo();
27 34  
  35 + ScheduledExecutorService sexec = Application.mainServices;
  36 + //定时将人车卡数据入库
  37 + sexec.scheduleWithFixedDelay(rfidCardInfoPersistenceThread, 120, 60 * 5, TimeUnit.SECONDS);
28 38 //OldWSClient.returnCCInfo();
29 39 //OldWSClient.getCurrentDayPlan();
30 40 } catch (Exception e) {
... ...
src/main/java/com/bsth/server_rs/thread/RfidCardInfoPersistenceThread.java
... ... @@ -37,6 +37,7 @@ public class RfidCardInfoPersistenceThread extends Thread{
37 37 try{
38 38 personCardSave();
39 39 carCardSave();
  40 + logger.info("RfidCardInfoPersistenceThread..");
40 41 }catch (Exception e){
41 42 logger.error("", e);
42 43 }
... ...