zyx 1 年之前
父节点
当前提交
706c054ae5
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/main/java/com/sxtvs/open/api/review/service/impl/SSEService.java

+ 3 - 2
src/main/java/com/sxtvs/open/api/review/service/impl/SSEService.java

@@ -12,13 +12,14 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ThreadPoolExecutor;
 
 @Service
 public class SSEService {
 
-    private Map<Long, SseEmitter>  sseMap = new HashMap<>();
-    private Map<Long, SseEmitter>  sseDataMap = new HashMap<>();
+    private Map<Long, SseEmitter>  sseMap = new ConcurrentHashMap<>();
+    private Map<Long, SseEmitter>  sseDataMap = new ConcurrentHashMap<>();
 
     public void monitor(String token, SseEmitter sseEmitter) {