mukkachaitanya commented on code in PR #13165:
URL: https://github.com/apache/kafka/pull/13165#discussion_r1161593044


##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/DelegatingClassLoader.java:
##########
@@ -360,17 +360,22 @@ private PluginScanResult scanPluginPath(
         builder.useParallelExecutor();
         Reflections reflections = new InternalReflections(builder);
 
-        return new PluginScanResult(
-                getPluginDesc(reflections, SinkConnector.class, loader),
-                getPluginDesc(reflections, SourceConnector.class, loader),
-                getPluginDesc(reflections, Converter.class, loader),
-                getPluginDesc(reflections, HeaderConverter.class, loader),
-                getTransformationPluginDesc(loader, reflections),
-                getPredicatePluginDesc(loader, reflections),
-                getServiceLoaderPluginDesc(ConfigProvider.class, loader),
-                getServiceLoaderPluginDesc(ConnectRestExtension.class, loader),
-                
getServiceLoaderPluginDesc(ConnectorClientConfigOverridePolicy.class, loader)
-        );
+        ClassLoader savedLoader = Plugins.compareAndSwapLoaders(loader);

Review Comment:
   `Plugins#withClassLoader` would be a nice touch to do these repetitive 
swaps; however, it doesn't seem to be a static method. I don't see a strong 
reason why it's not. If it's not too much out of the scope of this PR, can we 
make it static and use it to make the code cleaner? 
   
   Alternatively, if there are several instances where the code benefits form 
using the new static method we can tackle it with another refactor PR.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to