Commit 93d8467db4b030fb87186c4c24c2e89306bf14eb

Authored by 潘钊
1 parent d42137e9

update...

src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
... ... @@ -144,7 +144,6 @@ public class AdminUtilsController {
144 144 rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size());
145 145 rs.put("pst_sch_size", dayOfSchedule.getPstSize());
146 146 rs.put("speeds_size", OverspeedProcess.size());
147   - rs.put("60_pst_size", DayOfDirectives.pstSize());
148 147 return rs;
149 148 }
150 149  
... ...
src/main/java/com/bsth/data/directive/DayOfDirectives.java
... ... @@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
16 16  
17 17 import java.util.*;
18 18 import java.util.concurrent.ConcurrentHashMap;
  19 +import java.util.concurrent.ConcurrentLinkedQueue;
19 20 import java.util.concurrent.ConcurrentMap;
20 21  
21 22 /**
... ... @@ -36,9 +37,9 @@ public class DayOfDirectives {
36 37 public static ConcurrentMap<String, D64> d64Map;
37 38  
38 39 //等待插入的指令
39   - public static LinkedList<Directive> pstDirectives;
  40 + public static ConcurrentLinkedQueue<Directive> pstDirectives;
40 41 //等待更新的指令
41   - public static LinkedList<D60> pstD60s;
  42 + public static ConcurrentLinkedQueue<D60> pstD60s;
42 43  
43 44 @Autowired
44 45 DirectiveService directiveService;
... ... @@ -55,8 +56,8 @@ public class DayOfDirectives {
55 56 static{
56 57 d60Map = new ConcurrentHashMap<>();
57 58 d64Map = new ConcurrentHashMap<>();
58   - pstDirectives = new LinkedList<>();
59   - pstD60s = new LinkedList<>();
  59 + pstDirectives = new ConcurrentLinkedQueue<>();
  60 + pstD60s = new ConcurrentLinkedQueue<>();
60 61 }
61 62  
62 63 public void put60(D60 d60) {
... ... @@ -71,10 +72,6 @@ public class DayOfDirectives {
71 72 pstDirectives.add(d64);
72 73 }
73 74  
74   - public static int pstSize(){
75   - return pstDirectives.size();
76   - }
77   -
78 75 /**
79 76 *
80 77 * @Title: reply @Description: TODO(指令 46,47 响应) @throws
... ...
src/main/java/com/bsth/data/directive/DirectivesPstThread.java
... ... @@ -24,8 +24,8 @@ import java.sql.PreparedStatement;
24 24 import java.sql.SQLException;
25 25 import java.sql.Types;
26 26 import java.util.ArrayList;
27   -import java.util.LinkedList;
28 27 import java.util.List;
  28 +import java.util.concurrent.ConcurrentLinkedQueue;
29 29  
30 30 /**
31 31 * 指令持久化线程
... ... @@ -53,8 +53,7 @@ public class DirectivesPstThread extends Thread {
53 53 @Override
54 54 public void run() {
55 55 try{
56   - LinkedList<Directive> list = DayOfDirectives.pstDirectives;
57   - logger.info("开始指令入库: " + list.size());
  56 + ConcurrentLinkedQueue<Directive> list = DayOfDirectives.pstDirectives;
58 57  
59 58 List<D60> d60s = new ArrayList<>();
60 59 List<D64> d64s = new ArrayList<>();
... ... @@ -86,7 +85,7 @@ public class DirectivesPstThread extends Thread {
86 85  
87 86  
88 87 // 60 指令更新(车载响应)
89   - LinkedList<D60> updateD60s = DayOfDirectives.pstD60s;
  88 + ConcurrentLinkedQueue<D60> updateD60s = DayOfDirectives.pstD60s;
90 89 d60s = new ArrayList<>();
91 90 for (int i = 0; i < 2000; i++) {
92 91 d60 = updateD60s.poll();
... ...