Additional logging of WS commands processing
This commit is contained in:
parent
af03c528af
commit
811f7d7206
@ -95,7 +95,8 @@ public class DefaultTbEntityDataSubscriptionService implements TbEntityDataSubsc
|
|||||||
private static final int DEFAULT_LIMIT = 100;
|
private static final int DEFAULT_LIMIT = 100;
|
||||||
private final Map<String, Map<Integer, TbAbstractSubCtx>> subscriptionsBySessionId = new ConcurrentHashMap<>();
|
private final Map<String, Map<Integer, TbAbstractSubCtx>> subscriptionsBySessionId = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@Autowired @Lazy
|
@Autowired
|
||||||
|
@Lazy
|
||||||
private WebSocketService wsService;
|
private WebSocketService wsService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -728,7 +729,14 @@ public class DefaultTbEntityDataSubscriptionService implements TbEntityDataSubsc
|
|||||||
public void cancelAllSessionSubscriptions(String sessionId) {
|
public void cancelAllSessionSubscriptions(String sessionId) {
|
||||||
Map<Integer, TbAbstractSubCtx> sessionSubs = subscriptionsBySessionId.remove(sessionId);
|
Map<Integer, TbAbstractSubCtx> sessionSubs = subscriptionsBySessionId.remove(sessionId);
|
||||||
if (sessionSubs != null) {
|
if (sessionSubs != null) {
|
||||||
sessionSubs.values().forEach(this::cleanupAndCancel);
|
sessionSubs.values().forEach(sub -> {
|
||||||
|
try {
|
||||||
|
cleanupAndCancel(sub);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("[{}] Failed to remove subscription {} due to ", sub.getTenantId(), sub, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -217,7 +217,11 @@ public class DefaultTbLocalSubscriptionService implements TbLocalSubscriptionSer
|
|||||||
Map<Integer, TbSubscription<?>> sessionSubscriptions = subscriptionsBySessionId.remove(sessionId);
|
Map<Integer, TbSubscription<?>> sessionSubscriptions = subscriptionsBySessionId.remove(sessionId);
|
||||||
if (sessionSubscriptions != null) {
|
if (sessionSubscriptions != null) {
|
||||||
for (TbSubscription<?> subscription : sessionSubscriptions.values()) {
|
for (TbSubscription<?> subscription : sessionSubscriptions.values()) {
|
||||||
|
try {
|
||||||
modifySubscription(subscription.getTenantId(), subscription.getEntityId(), subscription, false);
|
modifySubscription(subscription.getTenantId(), subscription.getEntityId(), subscription, false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("[{}][{}] Failed to remove subscription {} due to ", subscription.getTenantId(), subscription.getEntityId(), subscription, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.debug("[{}] No session subscriptions found!", sessionId);
|
log.debug("[{}] No session subscriptions found!", sessionId);
|
||||||
|
|||||||
@ -197,7 +197,8 @@ public class DefaultWebSocketService implements WebSocketService {
|
|||||||
wsSessionsMap.put(sessionId, new WsSessionMetaData(sessionRef));
|
wsSessionsMap.put(sessionId, new WsSessionMetaData(sessionRef));
|
||||||
break;
|
break;
|
||||||
case ERROR:
|
case ERROR:
|
||||||
log.debug("[{}] Unknown websocket session error: {}. ", sessionId, event.getError().orElse(null));
|
log.debug("[{}] Unknown websocket session error: ", sessionId,
|
||||||
|
event.getError().orElse(new RuntimeException("No error specified")));
|
||||||
break;
|
break;
|
||||||
case CLOSED:
|
case CLOSED:
|
||||||
wsSessionsMap.remove(sessionId);
|
wsSessionsMap.remove(sessionId);
|
||||||
|
|||||||
@ -33,7 +33,7 @@ public class WebSocketSessionRef {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final String sessionId;
|
private final String sessionId;
|
||||||
private SecurityUser securityCtx;
|
private volatile SecurityUser securityCtx;
|
||||||
private final InetSocketAddress localAddress;
|
private final InetSocketAddress localAddress;
|
||||||
private final InetSocketAddress remoteAddress;
|
private final InetSocketAddress remoteAddress;
|
||||||
private final WebSocketSessionType sessionType;
|
private final WebSocketSessionType sessionType;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user