【CTC发送初始化消息去除synchronized关键字】

This commit is contained in:
weizhihong 2022-07-18 16:00:11 +08:00
parent edb9f46753
commit 32ae4fc71b

View File

@ -303,26 +303,23 @@ public class CTCLogicLoop {
*/ */
public void sendAllRunPlanChangeMessage(Simulation simulation, Set<String> userIds) { public void sendAllRunPlanChangeMessage(Simulation simulation, Set<String> userIds) {
// CTC运行日志发消息 // CTC运行日志发消息
synchronized (this) {
Map<String, CtcStationRunPlanLogVO> ctcRunPlanVOMap = simulation.getCtcRepository().getRunPlanStatusVOMap(); Map<String, CtcStationRunPlanLogVO> ctcRunPlanVOMap = simulation.getCtcRepository().getRunPlanStatusVOMap();
List<CtcStationRunPlanLogVO> messageList = null;
if (CollectionUtils.isEmpty(ctcRunPlanVOMap)) {
List<CtcStationRunPlanLog> allRunPlanList = simulation.getCtcRepository().getAllRunPlanList(); List<CtcStationRunPlanLog> allRunPlanList = simulation.getCtcRepository().getAllRunPlanList();
messageList = new ArrayList<>(allRunPlanList.size()); List<CtcStationRunPlanLogVO> messageList = new ArrayList<>(allRunPlanList.size());
String mapKey = null; String mapKey = null;
CtcStationRunPlanLogVO ctcStationRunPlanLogVO = null; CtcStationRunPlanLogVO ctcStationRunPlanLogVO = null;
for (CtcStationRunPlanLog runPlan : allRunPlanList) { for (CtcStationRunPlanLog runPlan : allRunPlanList) {
mapKey = runPlan.getStation().getCode() + "_" + runPlan.getCode(); mapKey = runPlan.getStation().getCode() + "_" + runPlan.getCode();
if (ctcRunPlanVOMap.containsKey(mapKey)) {
messageList.add(ctcRunPlanVOMap.get(mapKey));
} else {
ctcStationRunPlanLogVO = new CtcStationRunPlanLogVO(runPlan); ctcStationRunPlanLogVO = new CtcStationRunPlanLogVO(runPlan);
ctcRunPlanVOMap.put(mapKey, ctcStationRunPlanLogVO); ctcRunPlanVOMap.put(mapKey, ctcStationRunPlanLogVO);
messageList.add(ctcStationRunPlanLogVO); messageList.add(ctcStationRunPlanLogVO);
} }
} else {
messageList = new ArrayList<>(ctcRunPlanVOMap.values());
} }
sendCtcMessage(simulation.getId(), messageList, WebSocketMessageType.SIMULATION_CTC_RUN_PLAN_INIT, userIds); sendCtcMessage(simulation.getId(), messageList, WebSocketMessageType.SIMULATION_CTC_RUN_PLAN_INIT, userIds);
} }
}
/** /**
* 运行计划发送变化事件 * 运行计划发送变化事件