|
@@ -26,12 +26,12 @@ import static org.springframework.http.MediaType.APPLICATION_JSON;
|
|
|
*/
|
|
|
@Service
|
|
|
public class SysSSEServiceImpl implements ISysSSEService {
|
|
|
- private final static Map<Long, Map<String, SseEmitter>> USER_TOKEN_EMITTERS = new ConcurrentHashMap<>();
|
|
|
+ private final static Map<Long, ConcurrentHashMap<String, SseEmitter>> USER_TOKEN_EMITTERS = new ConcurrentHashMap<>();
|
|
|
|
|
|
@Override
|
|
|
public SseEmitter connect() {
|
|
|
UserSession userSession = UserSession.getLoginInfo();
|
|
|
- Map<String, SseEmitter> emitters = USER_TOKEN_EMITTERS.computeIfAbsent(userSession.getId(), k -> new HashMap<>());
|
|
|
+ Map<String, SseEmitter> emitters = USER_TOKEN_EMITTERS.computeIfAbsent(userSession.getId(), k -> new ConcurrentHashMap<>());
|
|
|
|
|
|
// 创建一个新的 SseEmitter 实例,默认30秒超时,设置为0L则永不超时
|
|
|
SseEmitter emitter = new SseEmitter(0L);
|