C0urante commented on code in PR #12281:
URL: https://github.com/apache/kafka/pull/12281#discussion_r896319034


##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/DelegatingClassLoader.java:
##########
@@ -222,14 +222,10 @@ protected PluginClassLoader newPluginClassLoader(
     private <T> void addPlugins(Collection<PluginDesc<T>> plugins, ClassLoader 
loader) {
         for (PluginDesc<T> plugin : plugins) {
             String pluginClassName = plugin.className();
-            SortedMap<PluginDesc<?>, ClassLoader> inner = 
pluginLoaders.get(pluginClassName);
-            if (inner == null) {
-                inner = new TreeMap<>();
-                pluginLoaders.put(pluginClassName, inner);
-                // TODO: once versioning is enabled this line should be moved 
outside this if branch
+            pluginLoaders.computeIfAbsent(pluginClassName, k -> {

Review Comment:
   Is this actually done concurrently? I was under the impression that this 
logic was all handled on a single thread.
   
   The map may be a `ConcurrentMap` in order to ensure that we can have one 
writer and an arbitrary number of readers at a single time, which might come in 
handy if a class has static initialization logic that spawns other threads 
which in turn make implicit calls to `DelegatingClassLoader::loadClass`.



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