kpatelatwork commented on a change in pull request #10549:
URL: https://github.com/apache/kafka/pull/10549#discussion_r615310932



##########
File path: 
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/DelegatingClassLoader.java
##########
@@ -187,17 +192,24 @@ private static PluginClassLoader newPluginClassLoader(
         );
     }
 
-    private <T> void addPlugins(Collection<PluginDesc<T>> plugins, ClassLoader 
loader) {
+    //visible for testing
+    <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);
+            boolean pluginConflict = false;
             if (inner == null) {
                 inner = new TreeMap<>();
                 pluginLoaders.put(pluginClassName, inner);
                 // TODO: once versioning is enabled this line should be moved 
outside this if branch
                 log.info("Added plugin '{}'", pluginClassName);
+            } else {
+                pluginConflict = true;
             }
             inner.put(plugin, loader);
+            if (pluginConflict) {
+                log.error("Detected multiple copies of plugin '{}', one of 
these will be used '{}'", pluginClassName, inner.keySet());
+            }

Review comment:
       I had discussed that case with Randall and you are right detecting and 
logging only once would need the change to inspect the map after all plugins 
are loaded but soon we will be working on dynamically loading plugins at 
runtime to improve the worker startup time so it would be a moot point to do it 
that way.  This is why it's ok to see the same statement twice as it would be 
rare for someone to have 3 copies of the same plugin.
   
   sure let me make the change to log which one will be used as of the time 
when statement is logged.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to