imbajin commented on code in PR #3457:
URL: https://github.com/apache/hugegraph/pull/3457#discussion_r4505023887


##########
hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java:
##########
@@ -636,7 +636,14 @@ public V get(Object key) {
         }
 
         public V put(K key, V value) {
-            if (this.key1 == null) {
+            // Update the slot already holding this key before taking a free 
one

Review Comment:
   ⚠️ **Important:** The slot update uses identity, but the backing `HashMap` 
uses equality. Two distinct `String` objects with the same name can leave the 
first cached slot holding the old value after the map is updated, so 
`child(name)` can still return a stale stopwatch. Please cover distinct equal 
keys and keep cached entries consistent with the map.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to