public class ClassLoadingUtils extends Object
| Constructor and Description |
|---|
ClassLoadingUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> CompletableFuture<T> |
guardCompletionWithContextClassLoader(CompletableFuture<T> future,
ClassLoader contextClassLoader) |
static <T,E extends Throwable> |
runWithContextClassLoader(org.apache.flink.util.function.SupplierWithException<T,E> supplier,
ClassLoader contextClassLoader)
Runs the given supplier in a
TemporaryClassLoaderContext based on the given
classloader. |
static <T extends Throwable> |
runWithContextClassLoader(org.apache.flink.util.function.ThrowingRunnable<T> runnable,
ClassLoader contextClassLoader)
Runs the given runnable in a
TemporaryClassLoaderContext to prevent the plugin class
loader from leaking into Flink. |
static Executor |
withContextClassLoader(Executor executor,
ClassLoader contextClassLoader)
Wraps the given executor such that all submitted are runnables are run in a
TemporaryClassLoaderContext based on the given classloader. |
static Runnable |
withContextClassLoader(Runnable runnable,
ClassLoader contextClassLoader)
Wraps the given runnable in a
TemporaryClassLoaderContext to prevent the plugin class
loader from leaking into Flink. |
public static Runnable withContextClassLoader(Runnable runnable, ClassLoader contextClassLoader)
TemporaryClassLoaderContext to prevent the plugin class
loader from leaking into Flink.runnable - runnable to wrapcontextClassLoader - class loader that should be set as the context class loaderpublic static Executor withContextClassLoader(Executor executor, ClassLoader contextClassLoader)
TemporaryClassLoaderContext based on the given classloader.executor - executor to wrapcontextClassLoader - class loader that should be set as the context class loaderpublic static <T extends Throwable> void runWithContextClassLoader(org.apache.flink.util.function.ThrowingRunnable<T> runnable, ClassLoader contextClassLoader) throws T extends Throwable
TemporaryClassLoaderContext to prevent the plugin class
loader from leaking into Flink.runnable - runnable to runcontextClassLoader - class loader that should be set as the context class loaderT extends Throwablepublic static <T,E extends Throwable> T runWithContextClassLoader(org.apache.flink.util.function.SupplierWithException<T,E> supplier, ClassLoader contextClassLoader) throws E extends Throwable
TemporaryClassLoaderContext based on the given
classloader.supplier - supplier to runcontextClassLoader - class loader that should be set as the context class loaderE extends Throwablepublic static <T> CompletableFuture<T> guardCompletionWithContextClassLoader(CompletableFuture<T> future, ClassLoader contextClassLoader)
Copyright © 2014–2025 The Apache Software Foundation. All rights reserved.