Aias00 commented on code in PR #7272:
URL: https://github.com/apache/shenyu/pull/7272#discussion_r4110065032
##########
shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/src/main/java/org/apache/shenyu/client/spring/websocket/init/SpringWebSocketClientEventListener.java:
##########
@@ -240,7 +243,7 @@ public String getPort() {
}
private void registerEndpointsBeans(final ApplicationContext context,
final Map<String, Object> endpointBeans) {
- if (CollectionUtils.isEmpty(endpointBeans)) {
+ if (CollectionUtils.isEmpty(endpointBeans) ||
!endpointsRegistered.compareAndSet(false, true)) {
Review Comment:
Question before merge (no code change necessarily needed): the short-circuit
on `isEmpty` first is exactly right - an empty context must not burn the guard,
which is what lets the later populated child register. But the guard itself is
per listener instance and global, so if a single instance serves a parent
**and** a child that both expose endpoints, only the first to refresh is
exported. The new test covers empty-parent + populated-child, not
populated-parent + populated-child.
Could you confirm whether each application context gets its own listener
instance? If yes, this is fine as-is; if not, either key the guard by context
identity or document that only the first context's endpoints are exported.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]