public LoaderSwap withClassLoader(ClassLoader loader) {
        ClassLoader savedLoader = compareAndSwapLoaders(loader);
        try {
            return new LoaderSwap(savedLoader);
        } catch (Throwable t) {
            compareAndSwapLoaders(savedLoader);
            throw t;
        }
    }
Perform the following operations with a specified thread context classloader.
<p>
Intended for use in a try-with-resources block such as the following:
<pre>{@code
try (LoaderSwap loaderSwap = plugins.withClassLoader(loader)) {
    // operation(s) sensitive to the thread context classloader
}
}</pre>
After the completion of the try block, the previous context classloader will be restored.
@see Thread#getContextClassLoader()
@see LoaderSwap
@param loader ClassLoader to use as the thread context classloader
@return A {@link LoaderSwap} handle which restores the prior classloader on {@link LoaderSwap#close()}.
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/Plugins.java