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

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

View File

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