caigy commented on code in PR #5008:
URL: https://github.com/apache/rocketmq/pull/5008#discussion_r964322703


##########
common/src/main/java/org/apache/rocketmq/common/utils/ConcurrentHashMapUtils.java:
##########
@@ -39,10 +37,11 @@ private ConcurrentHashMapUtil() {
      */
     public static <K, V> V computeIfAbsent(ConcurrentMap<K, V> map, K key, 
Function<? super K, ? extends V> func) {
         if (IS_JDK8) {
-            V v, newValue;
-            return ((v = map.get(key)) == null &&
-                (newValue = func.apply(key)) != null &&
-                (v = map.putIfAbsent(key, newValue)) == null) ? newValue : v;
+            V v = map.get(key);
+            if (null == v) {
+                v = map.computeIfAbsent(key, func);
+            }
+            return v;

Review Comment:
   Could you also provide JMH test results for this change?



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

Reply via email to