sashapolo commented on a change in pull request #174:
URL: https://github.com/apache/ignite-3/pull/174#discussion_r659666327



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
##########
@@ -328,14 +334,7 @@ public static ClassLoader igniteClassLoader() {
         if (ldr == null)
             ldr = igniteClassLoader;
 
-        ConcurrentMap<String, Class<?>> ldrMap = classCache.get(ldr);
-
-        if (ldrMap == null) {
-            ConcurrentMap<String, Class<?>> old = classCache.putIfAbsent(ldr, 
ldrMap = new ConcurrentHashMap<>());
-
-            if (old != null)
-                ldrMap = old;
-        }
+        ConcurrentMap<String, Class<?>> ldrMap = 
classCache.computeIfAbsent(ldr, k -> new ConcurrentHashMap<>());

Review comment:
       > Is there a reason for this change other than code simplicity?
   no
   > Sadly, computeIfAbsent is a blocking method
   I think we had a discussion about this a while ago and we found out that 
this is not entirely true, at least for Java 9+

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
##########
@@ -328,14 +334,7 @@ public static ClassLoader igniteClassLoader() {
         if (ldr == null)
             ldr = igniteClassLoader;
 
-        ConcurrentMap<String, Class<?>> ldrMap = classCache.get(ldr);
-
-        if (ldrMap == null) {
-            ConcurrentMap<String, Class<?>> old = classCache.putIfAbsent(ldr, 
ldrMap = new ConcurrentHashMap<>());
-
-            if (old != null)
-                ldrMap = old;
-        }
+        ConcurrentMap<String, Class<?>> ldrMap = 
classCache.computeIfAbsent(ldr, k -> new ConcurrentHashMap<>());

Review comment:
       > Is there a reason for this change other than code simplicity?
   
   no
   > Sadly, computeIfAbsent is a blocking method
   
   I think we had a discussion about this a while ago and we found out that 
this is not entirely true, at least for Java 9+




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