Commit 28bfd212614f89e5a0c4c8d7137c6d5b9351af95
1 parent
e6014c28
update...
Showing
2 changed files
with
23 additions
and
15 deletions
src/main/java/com/bsth/Application.java
| @@ -17,7 +17,7 @@ import java.util.concurrent.ScheduledExecutorService; | @@ -17,7 +17,7 @@ import java.util.concurrent.ScheduledExecutorService; | ||
| 17 | @SpringBootApplication | 17 | @SpringBootApplication |
| 18 | public class Application extends SpringBootServletInitializer { | 18 | public class Application extends SpringBootServletInitializer { |
| 19 | 19 | ||
| 20 | - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(16); | 20 | + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(17); |
| 21 | 21 | ||
| 22 | @Override | 22 | @Override |
| 23 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | 23 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
src/main/java/com/bsth/data/schedule/auto_exec/AutoExecScanThread.java
| @@ -4,6 +4,8 @@ import com.bsth.data.LineConfigData; | @@ -4,6 +4,8 @@ import com.bsth.data.LineConfigData; | ||
| 4 | import com.bsth.data.schedule.DayOfSchedule; | 4 | import com.bsth.data.schedule.DayOfSchedule; |
| 5 | import com.bsth.entity.realcontrol.LineConfig; | 5 | import com.bsth.entity.realcontrol.LineConfig; |
| 6 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 6 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | import org.springframework.stereotype.Component; | 10 | import org.springframework.stereotype.Component; |
| 9 | 11 | ||
| @@ -28,25 +30,31 @@ public class AutoExecScanThread extends Thread{ | @@ -28,25 +30,31 @@ public class AutoExecScanThread extends Thread{ | ||
| 28 | @Autowired | 30 | @Autowired |
| 29 | RealScheduleAutoExecHandler realScheduleAutoExecHandler; | 31 | RealScheduleAutoExecHandler realScheduleAutoExecHandler; |
| 30 | 32 | ||
| 33 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 34 | + | ||
| 31 | @Override | 35 | @Override |
| 32 | public void run() { | 36 | public void run() { |
| 33 | - //要自动执行的线路 | ||
| 34 | - List<String> autos = new ArrayList<>(); | ||
| 35 | - Collection<LineConfig> lcs = lineConfigData.getAll(); | ||
| 36 | - | ||
| 37 | - for(LineConfig config : lcs){ | ||
| 38 | - if(config.isAutoExec()){ | ||
| 39 | - autos.add(config.getLine().getLineCode()); | 37 | + try{ |
| 38 | + //要自动执行的线路 | ||
| 39 | + List<String> autos = new ArrayList<>(); | ||
| 40 | + Collection<LineConfig> lcs = lineConfigData.getAll(); | ||
| 41 | + | ||
| 42 | + for(LineConfig config : lcs){ | ||
| 43 | + if(config.isAutoExec()){ | ||
| 44 | + autos.add(config.getLine().getLineCode()); | ||
| 45 | + } | ||
| 40 | } | 46 | } |
| 41 | - } | ||
| 42 | 47 | ||
| 43 | - if(autos.size()==0) | ||
| 44 | - return; | ||
| 45 | - List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()); | ||
| 46 | - for(ScheduleRealInfo sch : all){ | ||
| 47 | - if(autos.contains(sch.getXlBm())){ | ||
| 48 | - realScheduleAutoExecHandler.exec(sch); | 48 | + if(autos.size()==0) |
| 49 | + return; | ||
| 50 | + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()); | ||
| 51 | + for(ScheduleRealInfo sch : all){ | ||
| 52 | + if(autos.contains(sch.getXlBm())){ | ||
| 53 | + realScheduleAutoExecHandler.exec(sch); | ||
| 54 | + } | ||
| 49 | } | 55 | } |
| 56 | + }catch (Exception e){ | ||
| 57 | + logger.error("", e); | ||
| 50 | } | 58 | } |
| 51 | } | 59 | } |
| 52 | } | 60 | } |