Commit 93d8467db4b030fb87186c4c24c2e89306bf14eb
1 parent
d42137e9
update...
Showing
3 changed files
with
8 additions
and
13 deletions
src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
| @@ -144,7 +144,6 @@ public class AdminUtilsController { | @@ -144,7 +144,6 @@ public class AdminUtilsController { | ||
| 144 | rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size()); | 144 | rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size()); |
| 145 | rs.put("pst_sch_size", dayOfSchedule.getPstSize()); | 145 | rs.put("pst_sch_size", dayOfSchedule.getPstSize()); |
| 146 | rs.put("speeds_size", OverspeedProcess.size()); | 146 | rs.put("speeds_size", OverspeedProcess.size()); |
| 147 | - rs.put("60_pst_size", DayOfDirectives.pstSize()); | ||
| 148 | return rs; | 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,6 +16,7 @@ import org.springframework.stereotype.Component; | ||
| 16 | 16 | ||
| 17 | import java.util.*; | 17 | import java.util.*; |
| 18 | import java.util.concurrent.ConcurrentHashMap; | 18 | import java.util.concurrent.ConcurrentHashMap; |
| 19 | +import java.util.concurrent.ConcurrentLinkedQueue; | ||
| 19 | import java.util.concurrent.ConcurrentMap; | 20 | import java.util.concurrent.ConcurrentMap; |
| 20 | 21 | ||
| 21 | /** | 22 | /** |
| @@ -36,9 +37,9 @@ public class DayOfDirectives { | @@ -36,9 +37,9 @@ public class DayOfDirectives { | ||
| 36 | public static ConcurrentMap<String, D64> d64Map; | 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 | @Autowired | 44 | @Autowired |
| 44 | DirectiveService directiveService; | 45 | DirectiveService directiveService; |
| @@ -55,8 +56,8 @@ public class DayOfDirectives { | @@ -55,8 +56,8 @@ public class DayOfDirectives { | ||
| 55 | static{ | 56 | static{ |
| 56 | d60Map = new ConcurrentHashMap<>(); | 57 | d60Map = new ConcurrentHashMap<>(); |
| 57 | d64Map = new ConcurrentHashMap<>(); | 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 | public void put60(D60 d60) { | 63 | public void put60(D60 d60) { |
| @@ -71,10 +72,6 @@ public class DayOfDirectives { | @@ -71,10 +72,6 @@ public class DayOfDirectives { | ||
| 71 | pstDirectives.add(d64); | 72 | pstDirectives.add(d64); |
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | - public static int pstSize(){ | ||
| 75 | - return pstDirectives.size(); | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | /** | 75 | /** |
| 79 | * | 76 | * |
| 80 | * @Title: reply @Description: TODO(指令 46,47 响应) @throws | 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,8 +24,8 @@ import java.sql.PreparedStatement; | ||
| 24 | import java.sql.SQLException; | 24 | import java.sql.SQLException; |
| 25 | import java.sql.Types; | 25 | import java.sql.Types; |
| 26 | import java.util.ArrayList; | 26 | import java.util.ArrayList; |
| 27 | -import java.util.LinkedList; | ||
| 28 | import java.util.List; | 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,8 +53,7 @@ public class DirectivesPstThread extends Thread { | ||
| 53 | @Override | 53 | @Override |
| 54 | public void run() { | 54 | public void run() { |
| 55 | try{ | 55 | try{ |
| 56 | - LinkedList<Directive> list = DayOfDirectives.pstDirectives; | ||
| 57 | - logger.info("开始指令入库: " + list.size()); | 56 | + ConcurrentLinkedQueue<Directive> list = DayOfDirectives.pstDirectives; |
| 58 | 57 | ||
| 59 | List<D60> d60s = new ArrayList<>(); | 58 | List<D60> d60s = new ArrayList<>(); |
| 60 | List<D64> d64s = new ArrayList<>(); | 59 | List<D64> d64s = new ArrayList<>(); |
| @@ -86,7 +85,7 @@ public class DirectivesPstThread extends Thread { | @@ -86,7 +85,7 @@ public class DirectivesPstThread extends Thread { | ||
| 86 | 85 | ||
| 87 | 86 | ||
| 88 | // 60 指令更新(车载响应) | 87 | // 60 指令更新(车载响应) |
| 89 | - LinkedList<D60> updateD60s = DayOfDirectives.pstD60s; | 88 | + ConcurrentLinkedQueue<D60> updateD60s = DayOfDirectives.pstD60s; |
| 90 | d60s = new ArrayList<>(); | 89 | d60s = new ArrayList<>(); |
| 91 | for (int i = 0; i < 2000; i++) { | 90 | for (int i = 0; i < 2000; i++) { |
| 92 | d60 = updateD60s.poll(); | 91 | d60 = updateD60s.poll(); |