[GitHub] activemq-artemis pull request #2434: ARTEMIS-1867 FQQN for producers
Github user franz1981 commented on a diff in the pull request:
--- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java ---
@@ -53,7 +54,13 @@
private final Map<SimpleString, Integer> routingNamePositions = new ConcurrentHashMap<>();
- private final Map<Long, Binding> bindingsMap = new ConcurrentHashMap<>();
+ private final Map<Long, Binding> bindingsIdMap = new ConcurrentHashMap<>();
+ * This is the same as bindingsIdMap but indexed on the binding's uniqueName rather than ID. Two maps are
+ * maintained to speed routing, otherwise we'd have to loop through the bindingsIdMap when routing to an FQQN.
+ private final Map<SimpleString, Binding> bindingsNameMap = new ConcurrentHashMap<>();
--- End diff --
`bindingsIdMap` and `bindingsNameMap` aren't atomically updated with the same operation because are 2 different maps so I'm expecting that dependently on the timing, querying both could give different results (a `Binding` could be found in one map, but not on the other one).
It can be avoided if we always query them when both are stable: is it the case?
I hope to have explained it better what I mean: I'm not aware of the context of usage...