oscerd commented on code in PR #26533:
URL: https://github.com/apache/camel/pull/26533#discussion_r4044698538
##########
components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketHost.java:
##########
@@ -51,7 +51,8 @@ public class VertxWebsocketHost {
private final VertxWebsocketHostConfiguration hostConfiguration;
private final VertxWebsocketHostKey hostKey;
- private final Map<String, Route> routeRegistry = new HashMap<>();
+ // routes are added and removed as consumers start and stop, which the
route controller can do concurrently
+ private final Map<String, Route> routeRegistry = new ConcurrentHashMap<>();
Review Comment:
You are right, and the comment was overstating it — the map change on its
own guaranteed very little, and `stop()` clearing the registry under a
concurrent `connect()` is exactly the hole.
Rather than leave it as a tidy-up with a follow-up JIRA, the lifecycle
methods are now synchronized and the registry is a plain `HashMap` again,
documented as guarded by that monitor. `disconnectConsumer` drops the host with
`computeIfPresent` against the same key `connectConsumer` computes on, so a
consumer connecting at that moment either keeps the host or gets a fresh one.
The misleading comment is gone.
_Claude Code on behalf of oscerd_
##########
components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketHost.java:
##########
@@ -162,7 +163,9 @@ public void connect(VertxWebsocketConsumer consumer) {
public void disconnect(String path) {
LOG.info("Disconnected consumer for path {}", path);
Route route = routeRegistry.remove(path);
- route.remove();
+ if (route != null) {
+ route.remove();
+ }
if (routeRegistry.isEmpty()) {
Review Comment:
No action — this thread is a placeholder comment with no content. Resolving
to clear the merge gate; happy to reopen if something was meant to land here.
_Claude Code on behalf of oscerd_
--
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]