gharris1727 commented on code in PR #13165: URL: https://github.com/apache/kafka/pull/13165#discussion_r1204482479
########## connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/LoaderSwap.java: ########## @@ -24,13 +24,32 @@ public class LoaderSwap implements AutoCloseable { private final ClassLoader savedLoader; - public LoaderSwap(ClassLoader savedLoader) { + public static LoaderSwap use(ClassLoader loader) { + ClassLoader savedLoader = compareAndSwapLoaders(loader); + try { + return new LoaderSwap(savedLoader); + } catch (Throwable t) { + compareAndSwapLoaders(savedLoader); + throw t; + } + } Review Comment: I've reverted this change and left Plugins.compareAndSwapLoader unchanged. ########## connect/runtime/src/main/java/org/apache/kafka/connect/cli/AbstractConnectCli.java: ########## @@ -119,36 +120,37 @@ public Connect startConnect(Map<String, String> workerProps, String... extraArgs log.info("Scanning for plugin classes. This might take a moment ..."); Plugins plugins = new Plugins(workerProps); - plugins.compareAndSwapWithDelegatingLoader(); - T config = createConfig(workerProps); - log.debug("Kafka cluster ID: {}", config.kafkaClusterId()); + try (LoaderSwap loaderSwap = plugins.withClassLoader(plugins.delegatingLoader())) { Review Comment: I've reverted 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org